Spreadsheet.ReplaceMD

This function replaces the missing data in the specified range of variables in the spreadsheet.

Syntax Parameters Return Value
Sub Spreadsheet.ReplaceMD( _
    Variables As Variant, _
    Optional selectionIncludeExpression As String = "", _
    Optional selectionIncludeList As String = "", _
    Optional selectionExcludeExpression As String = "", _
    Optional selectionExcludeList As String = "", _
    Optional weightVar As Integer = 0)
  • Variables [in]

The variable range.

Type: Variant

  • selectionIncludeExpression [in,optional]

The selection condition inclusion expression. Note that this parameter defaults to an empty string.

Type: String

Default value: ""

  • selectionIncludeList [in,optional]

The selection condition inclusion list of cases. Note that this parameter defaults to an empty string.

Type: String

Default value: ""

  • selectionExcludeExpression [in,optional]

The selection condition exclusion expression. Note that this parameter defaults to an empty string.

Type: String

Default value: ""

  • selectionExcludeList [in,optional]

The selection condition exclusion list of cases. Note that this parameter defaults to an empty string.

Type: String

Default value: ""

  • weightVar [in,optional]

Which variable to use as the weight variable. Note that this parameter defaults to 0, implying that no weight variable will be used.

Type: Integer

Default value: 0

This function does not return a value.

SVB Example

Replacing missing data:

Option Base 1
Option Explicit
Sub Main
    Dim spr As Spreadsheet
    'assigns the spreadsheet adstudy.sta to the object spr
    Set spr = Spreadsheets.Open(Path & "\examples\datasets\weight.sta")
    'sets the spreadsheet to visible
    spr.Visible = True
    'replaces missing data for variables 1 to 3 and use
    'variable 2 as a weight variable,
    'from which the new value will be calculated
    spr.ReplaceMD("1-3",,,,,2)
End Sub