Login  Register

delete specific value label

Posted by emma78 on May 19, 2021; 1:38pm
URL: http://spssx-discussion.165.s1.nabble.com/delete-specific-value-label-tp5740529.html

Hi ,
is it possible to delete a specific value label for some variables which i
put together in a macro?
I tried this but the variables need a  'to' between them, and in a macro
they are separated with a comma.



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.


Thank you!



--
Sent from: http://spssx-discussion.1045642.n5.nabble.com/

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD