Spreadsheet.SubsetStratifiedRandomSampling
Thos property creates a new spreadsheet containing the specified subset of the current spreadsheet using selection conditions and Stratified Random Sampling.
Syntax | Parameters | Return Value |
---|---|---|
ReadOnly Property Spreadsheet.SubsetStratifiedRandomSampling( _ Variables As Variant, _ selectionIncludeExpression As String, _ selectionIncludeList As String, _ selectionExcludeExpression As String, _ selectionExcludeList As String, _ sVar As Variant, _ sCode As Variant, _ sProb As Variant, _ Optional bQuickRand As Boolean = True, _ Optional bSampleNumberOfCases As Boolean = False, _ Optional bUseSpreadsheetCaseWeights As Boolean = False, _ Optional bUseSpreadsheetSelCond As Boolean = False) As Spreadsheet |
Type: Variant Type: String Type: String Type: String Type: String Type: Variant Type: Variant Type: Variant Type: Boolean Default value: True Type: Boolean Default value: False Type: Boolean Default value: False Type: Boolean Default value: False |
Spreadsheet |
SVB Example
Creating a stratified random sample:
Option Base 1 Sub Main Dim spr As Spreadsheet 'assigns the active spreadsheet to the object spr Set spr = ActiveDataSet Dim outputspr As Spreadsheet 'this example was created using the example dataset adstudy.sta '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 specification of the Strata Variable(s) 'The seventh parameter is the codes for the Strata variable to be included in the subset 'The eighth parameter determines the percent or number of cases to be used for each strata code 'The ninth parameter determines whether or not to use quick random sampling 'The tenth parameter determines whether or not to sample based on N or Percentage 'The eleventh parameter determines the use of the spreadsheets case weights in the creation of the subset 'The last parameter the use of the spreadsheets selection conditions in the subset. Set outputspr = spr.SubsetStratifiedRandomSampling("*","","","","",1,"*",Array(.50,.50),True,False,False,False) 'display the spreadsheet object spr outputspr.Visible = True End Sub
Copyright © 2020. Cloud Software Group, Inc. All Rights Reserved.