Reverse ValueLabels function

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

Reverse ValueLabels function

Maguin, Eugene
The ValueLabels functions extracts the value labels for a variable into a
new variable. Is there a function (v17 only) to go the other way--to turn a
label coded in another variable into a value label for a primary variable. I
think the answer is No but I want to check.

Ps. I can do this using aggregate. It's several easy steps. I'm wondering
about something even easier.

Thanks, Gene Maguin

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: Reverse ValueLabels function

Jon K Peck

There is no built-in way to do this, but there is a Python function that will create the value labels:
begin program.
import spss, spssaux2
spssaux2.genValueLabels("target", "source")
end program.

"target" is the name of the variable for which value labels are to be created.  "source"
is the name of the variable whose values define the labels.  (The variable names are
case sensitive.)

HTH,
Jon Peck
SPSS, an IBM Company
[hidden email]
312-651-3435



From: Gene Maguin <[hidden email]>
To: [hidden email]
Date: 03/22/2010 07:49 AM
Subject: [SPSSX-L] Reverse ValueLabels function
Sent by: "SPSSX(r) Discussion" <[hidden email]>





The ValueLabels functions extracts the value labels for a variable into a
new variable. Is there a function (v17 only) to go the other way--to turn a
label coded in another variable into a value label for a primary variable. I
think the answer is No but I want to check.

Ps. I can do this using aggregate. It's several easy steps. I'm wondering
about something even easier.

Thanks, Gene Maguin

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