spssdictionary.SetDictionaryToSPSS Function (R)

spssdictionary.SetDictionaryToSPSS(datasetName,x,categoryDictionary,hidden). Creates a new IBM® SPSS® Statistics dataset with a specified dictionary.

  • The argument datasetName specifies the name of the IBM SPSS Statistics dataset to be created, and cannot be the name of an existing dataset.
  • The argument x is a data frame representing the dictionary and must be an object created by either the CreateSPSSDictionary function or the GetDictionaryFromSPSS function.
  • The optional argument categoryDictionary specifies the name of a category dictionary created with the GetCategoricalDictionaryFromSPSS function. Category dictionaries are for use when retrieving categorical variables (variables with a measurement level of "nominal" or "ordinal") into labeled R factors (factorMode="labels" in GetDataFromSPSS), with the intention of writing those factors to a new dataset. The value labels of the original categorical variables are automatically added to the new dataset.
  • The optional argument hidden specifies whether the Data Editor window associated with the new dataset is hidden--by default, it is displayed. Use hidden=TRUE to hide the associated Data Editor window.
  • The resulting IBM SPSS Statistics dataset is NOT set to be the active dataset. To make a new dataset the active one, use the SetActive function or the DATASET ACTIVATE command (outside of the program block that calls SetDictionaryToSPSS).
Important: Call the spssdictionary.EndDataStep function after you complete creation of the new dataset. After you call spssdictionary.SetDictionaryToSPSS and before you call spssdictionary.EndDataStep, you cannot call any of the following functions: spsspkg.Submit, spsspivottable.Display, spss.BasePivotTable, spsspkg.StartProcedure, or spssdata.GetDataFromSPSS.

Examples of using the SetDictionaryToSPSS function are best understood in the context of creating a new dataset. See the topic Writing Results to a New IBM SPSS Statistics Dataset (R) for more information.