How to find all variables that have a value label for value zero

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to find all variables that have a value label for value zero

Art Kendall
some of my numeric variables have a
value label VarType1 0 "Actual Zaro".

I am trying to get a list of all variables that have a label for values of
0.
Both of the syntax snippets below result in this message
"Warnings
No variables qualify for macro definition !MyVarList"

SPSSINC SELECT VARIABLES MACRONAME = '!MyVarList'
    /PROPERTIES
    TYPE=NUMERIC
    /ATTRHASALL 'Values' 'Source'
    /ATTRVALUES
    NAME = Values VALUE= "0"
    NAME1=Source VALUE1="input"
   /OPTIONS
    ORDER=FILE
    PRINT=YES.

SPSSINC SELECT VARIABLES MACRONAME = '!MyVarList'
    /PROPERTIES
    TYPE=NUMERIC
    /ATTRHASALL 'Values' 'Source'
    /ATTRVALUES
    NAME = Values VALUE= 0
    NAME1=Source VALUE1="input"
   /OPTIONS
    ORDER=FILE.

Alternatively is there a way to generate a list of all variables that have a
value label of "Actual Zero" no matter what value that is a label for?



-----
Art Kendall
Social Research Consultants
--
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
Art Kendall
Social Research Consultants
Reply | Threaded
Open this post in threaded view
|

Re: How to find all variables that have a value label for value zero

Jon Peck
You could use the CODEBOOK procedure with OMS to produce a large table of value labels, but here is a simpler solution.

begin program python3.
import spssaux

vardict=spssaux.VariableDict()
for v in vardict:
   vls = v.ValueLabels
   if "0" in vls:
       print(v.VariableName)
end program.

On Mon, Apr 5, 2021 at 1:12 PM Art Kendall <[hidden email]> wrote:
some of my numeric variables have a
value label VarType1 0 "Actual Zaro".

I am trying to get a list of all variables that have a label for values of
0.
Both of the syntax snippets below result in this message
"Warnings
No variables qualify for macro definition !MyVarList"

SPSSINC SELECT VARIABLES MACRONAME = '!MyVarList'
    /PROPERTIES
    TYPE=NUMERIC
    /ATTRHASALL 'Values' 'Source'
    /ATTRVALUES
    NAME = Values VALUE= "0"
    NAME1=Source VALUE1="input"
   /OPTIONS
    ORDER=FILE
    PRINT=YES.

SPSSINC SELECT VARIABLES MACRONAME = '!MyVarList'
    /PROPERTIES
    TYPE=NUMERIC
    /ATTRHASALL 'Values' 'Source'
    /ATTRVALUES
    NAME = Values VALUE= 0
    NAME1=Source VALUE1="input"
   /OPTIONS
    ORDER=FILE.

Alternatively is there a way to generate a list of all variables that have a
value label of "Actual Zero" no matter what value that is a label for?



-----
Art Kendall
Social Research Consultants
--
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


--
Jon K Peck
[hidden email]

===================== 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