Hello,
I'm working on recoding string data in IBM SPSS Statistics 24. There were not a lot of data quality control measures put in place at the frontend, so the data I'm working with needs to be cleaned and recoded. In addition, these data need to be recoded differently for different age groups. For example, kids under 5 were not supposed to be able to answer the question, so I want to change all the responses for anyone who is less than 5 to NA due to age.
I don't usually recode data in SPSS using syntax, but here's the syntax I wrote.
STRING R_WALKCLIMB_RECODED_USE_ME (A100).
DO IF (ee_AGE_RECODED>=5).
RECODE r_DisabilityWalkClimb ('D'='Declined') ('Declined'='Declined') ("Don't know"='Unknown')
("Don't want to answer"='Declined') ('N'='No') ('No'='No') ('U'='Unknown') ('Unknown'='Unknown')
('Y'='Yes') ('Yes'='Yes') INTO R_WALKCLIMB_RECODED_USE_ME.
ELSE IF (ee_AGE_RECODED<=5).
RECODE r_DisabilityWalkClimb ('D'='NA due to age') ('Declined'='NA due to risk') ("Don't know"='NA due to age')
("Don't want to answer"='NA due to age') ('N'='NA due to age') ('No'='NA due to age') ('U'='NA due to age') ('Unknown'='NA due to age')
('Y'='NA due to age') ('Yes'='NA due to age') INTO R_WALKCLIMB_RECODED_USE_ME.
VARIABLE LABELS R_WALKCLIMB_RECODED_USE_ME 'R_WALKCLIMB_RECODED_USE_ME'.
EXECUTE.
Here's the error messages I got:
>Warning # 142. Command name: EXECUTE
>LOOP has no effect on this command.
>Error # 4095. Command name: EXECUTE
>The transformations program contains an unclosed LOOP, DO IF, or complex file
>structure. Use the level-of-control shown to the left of the SPSS Statistics
>commands to determine the range of LOOPs and DO IFs.
>Execution of this command stops.
FREQUENCIES VARIABLES=R_WALKCLIMB_RECODED_USE_ME
>Warning # 142. Command name: FREQUENCIES
>LOOP has no effect on this command.
>Error # 4095. Command name: FREQUENCIES
>The transformations program contains an unclosed LOOP, DO IF, or complex file
>structure. Use the level-of-control shown to the left of the SPSS Statistics
>commands to determine the range of LOOPs and DO IFs.
>Execution of this command stops.
/ORDER=ANALYSIS.
Can anyone please help me?
------------------------------
Jacob Melson
------------------------------
#SPSSStatistics