spssdictionary.SetValueLabel Function (R)
spssdictionary.SetValueLabel(datasetName,variable,values,labels). Sets the value labels for a specified variable. This function is used to define value labels 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 argument values is a vector specifying the values for which labels will be set.
- The argument labels is a vector specifying the labels corresponding to the elements of values.
- The
SetValueLabel
function should be called afterSetDictionaryToSPSS
and before callingEndDataStep
.
Example
values <- c(0,1)
labels <- c("m","f")
spssdictionary.SetValueLabel("results","newvar",values,labels)