Shiri Bogomolny
2017-03-07 03:36:19 UTC
Hi,
I am trying to create a new variable in SPSS using two different additional variables. In Excel it would be a simple if statement (if variable=x pull from this column, otherwise pull form that column) but I can't get it to work here for some reason.
I have a variable that is membership type for a gym (Adult, youth, staff, etc) coded 1-8. I have another variable that is the age range of the member (18-29, 30-54, etc). I want to create a third variable in which if the member is an adult, rather than "adult" I want it to say his age range category. If the member is any other type of member I want it to retain the original membership type. I have coded both membership types and age ranges as values.
This is what I started:
DO IF (MemberCatNumber = 1).
RECODE AgeInMemberRange (30=30) (54=54) (18=18) INTO Final.
END IF.
EXECUTE.
DO IF (MemberCatNumber = 2).
RECODE MemberCatNumber (2 = 2) INTO Final.
END IF.
EXECUTE.
Thanks so much in advance for your support!
I am trying to create a new variable in SPSS using two different additional variables. In Excel it would be a simple if statement (if variable=x pull from this column, otherwise pull form that column) but I can't get it to work here for some reason.
I have a variable that is membership type for a gym (Adult, youth, staff, etc) coded 1-8. I have another variable that is the age range of the member (18-29, 30-54, etc). I want to create a third variable in which if the member is an adult, rather than "adult" I want it to say his age range category. If the member is any other type of member I want it to retain the original membership type. I have coded both membership types and age ranges as values.
This is what I started:
DO IF (MemberCatNumber = 1).
RECODE AgeInMemberRange (30=30) (54=54) (18=18) INTO Final.
END IF.
EXECUTE.
DO IF (MemberCatNumber = 2).
RECODE MemberCatNumber (2 = 2) INTO Final.
END IF.
EXECUTE.
Error # 4070. Command name: END IF
The command does not follow an unclosed DO IF command. Maybe the DO IF
command was not recognized because of an error. 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.
END IF.The command does not follow an unclosed DO IF command. Maybe the DO IF
command was not recognized because of an error. 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.
Thanks so much in advance for your support!