spssdictionary.SetVariableAttributes Function (R)

spssdictionary.SetVariableAttributes(datasetName,variable.attr1,...,attrN). Sets the variable attributes for a specified variable. This function is used to define custom variable attributes for new IBM® SPSS® Statistics datasets created with the SetDictionaryToSPSS function.

  • The argument datasetName is the name of the IBM SPSS Statistics dataset as specified on the call to the SetDictionaryToSPSS function used to create the dataset.
  • The argument variable can be a character string specifying the variable name or an integer specifying the index value of the variable (index values represent position in the dataset, starting with 0 for the first variable in file order). Variable names must match case with the names as they exist in the active dataset's dictionary.
  • The arguments attr1,...,attrN specify the attributes and are of the form attrName=attrValue, where attrName is the name of the attribute and attrValue is either a single character value or a character vector. Specifying a vector results in an attribute array.
  • The SetVariableAttributes function should be called after SetDictionaryToSPSS and before calling EndDataStep.

Example


spssdictionary.SetVariableAttributes("results","Gender",DemographicVars="1",
                                      Binary="Yes")