SPSS tutorials website header logo SPSS TUTORIALS BASICS ANOVA REGRESSION FACTOR CORRELATION

Remove Value Label from Multiple Variables

Question

"I'd like to completely remove the value label from a value for many variables at once. Is there an easy way to accomplish that?"

SPSS Python Syntax Example

begin program.
variables = 'v1 to v5' # Specify variables here.
value = 3 # Specify value to unlabel here.
import spss,spssaux
vDict = spssaux.VariableDict(caseless = True)
varList = vDict.expand(variables)
for var in varList:
    valLabs = vDict[vDict.VariableIndex(var)].ValueLabels
    if str(value) in valLabs:
        del valLabs[str(value)]
        vDict[vDict.VariableIndex(var)].ValueLabels = valLabs
end program.

Description

Tell us what you think!

*Required field. Your comment will show up after approval from a moderator.

THIS TUTORIAL HAS 8 COMMENTS: