spssdictionary.GetValueLabels Function (R)
spssdictionary.GetValueLabels(variable). Returns the value labels for the specified variable in the active dataset. The argument 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 result is a list. The first element of the list is a vector of values that have associated labels. The second element of the list is a vector with the associated labels.
- If there are no value labels, the list contains empty vectors.
Example
List all variables without value labels.
BEGIN PROGRAM R.
novallabelList <- vector()
dict <- spssdictionary.GetDictionaryFromSPSS()
varnames <- dict["varName",]
for (name in varnames){
if (length(spssdictionary.GetValueLabels(name)$values)==0)
novallabelList <- append(novallabelList,name)
}
{if (length(novallabelList) > 0) {
cat("Variables without value labels:\n")
cat(novallabelList,sep="\n")}
else
cat("All variables have value labels")
}
END PROGRAM.