Spreadsheet.SubsetRandomSamplingEx

This property creates a new spreadsheet containing the specified subset of the current spreadsheet using selection conditions and Random Sampling.

This property is read only.

Syntax Parameters Return Value
ReadOnly Property Spreadsheet.SubsetRandomSamplingEx( _
    Variables As Variant, _
    selectionIncludeExpression As String, _
    selectionIncludeList As String, _
    selectionExcludeExpression As String, _
    selectionExcludeList As String, _
    samplingType As RandomSamplingType, _
    PctOrNumberOfCases As Double, _
    Optional bQuickRand As Boolean = True, _
    Optional bWithReplacement As Boolean = False, _
    Optional bUseSpreadsheetCaseWeights As Boolean = False) As Spreadsheet
  • Variables [in]

Type: Variant

  • selectionIncludeExpression [in]

Type: String

  • selectionIncludeList [in]

Type: String

  • selectionExcludeExpression [in]

Type: String

  • selectionExcludeList [in]

Type: String

  • samplingType [in]

Type: RandomSamplingType

  • PctOrNumberOfCases [in]

Type: Double

  • bQuickRand [in,optional]

Type: Boolean

Default value: True

  • bWithReplacement [in,optional]

Type: Boolean

Default value: False

  • bUseSpreadsheetCaseWeights [in,optional]

Type: Boolean

Default value: False

Spreadsheet

SVB Example

Creating a random sample (advanced):

Option Base 1
Sub Main
    Dim spr As Spreadsheet
    'assigns the active spreadsheet to the object spr
    Set spr = ActiveDataSet
    Dim outputspr As Spreadsheet
    'assigns the spreadsheet object outputspr to the spreadsheet generated
    'from the SubsetRandomSampling property.
    'The first parameter is the number of variables to include in the subset
    '(Note that "*" = all variables), "1-5" would be used to include variables 1-5
    'The second, third, fourth, and fifth parameters are the selection condition statements
    'that will be included in the creation of the subset. If you do not wish to use one of
    'the selection condition parameters an empty string must be passed.
    'The sixth parameter is the sampling type to be used, this is either an approximate
    'percentage of the cases or an approximate number of cases.
    'The seventh parameter is the percentage or number of cases you would like to include in the subset
    'The eighth parameter determines the use of the quick random sampling algorithm
    'The ninth parameter determines the use of replacement in the creation of the subset
    'The last parameter determines the use of case weights in the creation of the subset
    Set outputspr = spr.SubsetRandomSamplingEx("*","v3>5","","","",scRandomSamplingPercentOfCases,50,True,False,False)
    'display the spreadsheet object spr
    outputspr.Visible = True
End Sub