value lables

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

value lables

drfg2008
my variable (i.e. v1) is numerical and consists of two variable labels: 1 = male, 2 = female.

I would like to change the variable into a type string variable with the variable labels saved not the code numbers. With "Alter Type (Ax) I would only get the numbers (as a string). But how to keep the labels?

thx. for help

* Example:

input program.
loop v1 =1 to 2 by 1.
end case.
end loop.
end file.
end input program.
EXECUTE.

VALUE LABELS v1 1'male' 2'female'.
Dr. Frank Gaeth

Reply | Threaded
Open this post in threaded view
|

Re: value lables

Anthony Babinec
Dr. Frank,
Look up the VALUELABEL function. From SPSS help:

VALUELABEL function


VALUELABEL. VALUELABEL(varname). String. Returns the value label for the
value of variable or an empty string if there is no label for the value. The
value of varname must be a variable name; it cannot be an expression.

Example
STRING labelvar (A120).
COMPUTE labelvar=VALUELABEL(var1).
DO REPEAT varlist=var2, var3, var4
         /newvars=labelvar2, labelvar3, labelvar4.
- STRING newvars(A120).
- COMPUTE newvars=VALUELABEL(varlist).
END REPEAT.

Tony Babinec
[hidden email]

-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
drfg2008
Sent: Friday, January 16, 2015 6:37 AM
To: [hidden email]
Subject: value lables

my variable (i.e. v1) is numerical and consists of two variable labels: 1 =
male, 2 = female.

I would like to change the variable into a type string variable with the
variable labels saved not the code numbers. With "Alter Type (Ax) I would
only get the numbers (as a string). But how to keep the labels?

thx. for help

* Example:

input program.
loop v1 =1 to 2 by 1.
end case.
end loop.
end file.
end input program.
EXECUTE.

VALUE LABELS v1 1'male' 2'female'.




-----
Dr. Frank Gaeth


--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/value-lables-tp5728417.html
Sent from the SPSSX Discussion mailing list archive at 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

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

value lables

John F Hall
In reply to this post by drfg2008
-----Original Message-----
From: John F Hall [mailto:[hidden email]]
Sent: 16 January 2015 14:15
To: 'drfg2008'
Subject: RE: value lables

Why on earth would you want to do that?  If your variable is already numeric
all you need is:

VALUE LABELS v1 1'Male' 2'Female'.
*check.
FREQUENCIES v1.

John F Hall (Mr)
[Retired academic survey researcher]

Email:   [hidden email]  
Website: www.surveyresearch.weebly.com SPSS start page:
www.surveyresearch.weebly.com/1-survey-analysis-workshop



-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of
drfg2008
Sent: 16 January 2015 13:37
To: [hidden email]
Subject: value lables

my variable (i.e. v1) is numerical and consists of two variable labels: 1 =
male, 2 = female.

I would like to change the variable into a type string variable with the
variable labels saved not the code numbers. With "Alter Type (Ax) I would
only get the numbers (as a string). But how to keep the labels?

thx. for help

* Example:

input program.
loop v1 =1 to 2 by 1.
end case.
end loop.
end file.
end input program.
EXECUTE.

VALUE LABELS v1 1'male' 2'female'.




-----
Dr. Frank Gaeth


--
View this message in context:
http://spssx-discussion.1045642.n5.nabble.com/value-lables-tp5728417.html
Sent from the SPSSX Discussion mailing list archive at 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

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