|
Dear Listers:
I have 2 variables which value labels and frequencies are as follows ========================================================== Q7: ... VALUE LABELS Frequency 1, 17 2, 12 3, 4 . 4, 7 5, 18 6, 12 7, 21 8, 47 9, 24 10, 51 Don't Know, 4 Total, 217 Missing System, 383 Total, 600 Q8: ... VALUE LABELS Frequency 1, 14 2, 13 3, 6 4, 8 5, 15 6, 8 7, 25 8, 53 9, 19 10, 52 Refused, 2 Total 215 Missing System 385 Total 600 100.0 ================================================ I would like to make D8A to D8E has the same bases as D7(total 217) by using following syntax but failed. Any suggestions would be appreciated. Thanks! ------------------------------------------------------------------------------ RECODE D7 D8A D8B D8C D8D D8E(MISSING = 101). IF((D7>=1) and (D8A= 101)) D8A=99. IF((D7>=1) and (D8B= 101)) D8B=99. IF((D7>=1) and (D8C= 101)) D8C=99. IF((D7>=1) and (D8D= 101)) D8D=99. IF((D7>=1) and (D8E= 101)) D8E=99. RECODE D7 D8A D8B D8C D8D D8E(101=sysmis). EXECUTE. ---------------------------------------------------------------------------- Hans Chen ===================== 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 |
|
At 10:56 PM 4/14/2008, Hans Chen wrote:
>I would like to make D8A to D8E has the same bases as D7(total 217) by >using following syntax but failed. >---------------------------------------------------------------------- >RECODE D7 D8A D8B D8C D8D D8E(MISSING = 101). >IF((D7>=1) and (D8A= 101)) D8A=99. >IF((D7>=1) and (D8B= 101)) D8B=99. >IF((D7>=1) and (D8C= 101)) D8C=99. >IF((D7>=1) and (D8D= 101)) D8D=99. >IF((D7>=1) and (D8E= 101)) D8E=99. >RECODE D7 D8A D8B D8C D8D D8E(101=sysmis). >---------------------------------------------------------------------- It's hard to say, because you don't say *how* it failed - what error messages you got, or how what you got was different from what you wanted. You may be having trouble with user-missing values; if D7 is missing the 'IF' statements can't test 'true', and they also can't if 101 is a user-missing value for the other variables. This should give what it looks like you want, regardless of user-missing settings. Note use of 'VALUE' function: RECODE D7 D8A D8B D8C D8D D8E(MISSING = 101). DO IF VALUE(D7)>=1. . RECODE D8A D8B D8C D8D D8E(101=99). END IF. RECODE D7 D8A D8B D8C D8D D8E(101=sysmis). ===================== 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 |
| Free forum by Nabble | Edit this page |
