|
RECODE ces04_CPS_S3 (1 thru 5=0) (6 thru 7 = 1) (8 thru 11=2) (98 =
sysmis) (99 = sysmis) into education. EXECUTE. RECODE ces06_CPS_S3 (1 thru 5=0) (6 thru 7 = 1) (8 thru 11=2) (98 = sysmis) (99 = sysmis) into education. EXECUTE. Can someone tell me why the first recode command won't touch the first variable, but the second one will? I cannot, for the life of me, recode the 04 variable, while the 06 works just fine. As does the 08 variable for which I'm using the identical syntax. I've tried the commands separately and in conjunction and for some reason, they are only converting the 06 variable.... Simon Kiss ********************************* Simon J. Kiss, PhD Assistant Professor, Wilfrid Laurier University 223 Grand River Hall, 171 Colborne Street Brantford, Ontario, Canada N3T 2C9 Cell: +1 519 761 7606 ===================== 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 |
|
What are you trying to do? In the syntax
below, the second Recode basically overwrites the first Recode since you're
recoding both original variables into the same new variable.
RECODE ces04_CPS_S3 (1 thru 5=0) (6 thru 7 = 1) (8 thru 11=2) (98 = sysmis) (99 = sysmis) into education. EXECUTE. RECODE ces06_CPS_S3 (1 thru 5=0) (6 thru 7 = 1) (8 thru 11=2) (98 = sysmis) (99 = sysmis) into education. EXECUTE. Can someone tell me why the first recode command won't touch the first variable, but the second one will? I cannot, for the life of me, recode the 04 variable, while the 06 works just fine. As does the 08 variable for which I'm using the identical syntax. I've tried the commands separately and in conjunction and for some reason, they are only converting the 06 variable.... Simon Kiss ********************************* Simon J. Kiss, PhD Assistant Professor, Wilfrid Laurier University 223 Grand River Hall, 171 Colborne Street Brantford, Ontario, Canada N3T 2C9 Cell: +1 519 761 7606 ===================== 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 |
|
In reply to this post by Simon Kiss-2
Simon
Why are you using such complex varnames? It's
much easier with V<n> names and use your long ones as labels. You'll
get RSI typing them all out!
You can do all the recodes in one pass (execute is
extravagant as it passes through the data every time: OK on small data sets, but
expensive if you have a large file.)
You don't need the execute, just
do
do repeat x = ces04_CPS_S3 ces06_CPS_S3
ces08_CPS_S3
/y
= education1 to education3 .
RECODE x (1 thru 5=0) (6, 7 = 1) (8 11=2) (98,
99 = sysmis) into y .
end repeat .
freq education1 to education3 .
If education is supposed to be the same variable
for everyone try this as well as freq:
mult resp education (education1 to education3
(0,2)
/freq education .
|
|
In reply to this post by Simon Kiss-2
Why would you recode 98 and 99 into sysmis? You lose the information
as to why the data is missing and it is NOT because the system was unable to follow your instructions which is what sysmis means. The user has some reasons that the values are missing, try something like this untested syntax. Also in your example the o6 variable is writing over the education variable. recode ces04_CPS_S3 ces06_CPS_S3 ces08_CPS_S3 (1 thru 5=0) (6 thru 7 = 1) (8 thru 11=2)(else = copy) into education04 education06 education08. missing values education04 education06 (98,99). value labels education 0 'a label' 1 'some words' 2 'other words' 98 'legitimate skip' 99 'refused to answer'. Art Kendall Social Research Consultants On 9/18/2010 2:18 PM, Simon Kiss wrote: > RECODE ces04_CPS_S3 (1 thru 5=0) (6 thru 7 = 1) (8 thru 11=2) (98 = > sysmis) (99 = sysmis) into education. > EXECUTE. > RECODE ces06_CPS_S3 (1 thru 5=0) (6 thru 7 = 1) (8 thru 11=2) (98 = > sysmis) (99 = sysmis) into education. > EXECUTE. > > Can someone tell me why the first recode command won't touch the first > variable, but the second one will? > I cannot, for the life of me, recode the 04 variable, while the 06 > works just fine. As does the 08 variable for which I'm using the > identical syntax. I've tried the commands separately and in > conjunction and for some reason, they are only converting the 06 > variable.... > Simon Kiss > ********************************* > Simon J. Kiss, PhD > Assistant Professor, Wilfrid Laurier University > 223 Grand River Hall, 171 Colborne Street > Brantford, Ontario, Canada > N3T 2C9 > Cell: +1 519 761 7606 > > ===================== > 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
Art Kendall
Social Research Consultants |
| Free forum by Nabble | Edit this page |
