Troubleshooting
Problem
How to recode multiple response variables in SPSS into a single categorical variable. Is it possible, if more than one choice is indicated , for the recode to use a priority system in choosing which one to specify in the new variable?
Resolving The Problem
Example:
Have variables v#a, v#b, v#c, .. v#h which each represent a choice of ethnicity and have a value of 1 if chosen by the respondent. Respondents can choose more than one ethnicity. Exampe of data:
id v#a v#b v#c v#d v#e v#f v#g v#h
1 1 0 0 0 0 0 0 0
2 1 1 0 0 0 0 0 0
3 0 0 1 0 0 1 0 0
Syntax to create new variable (ethnic) and value labels and how to set priority:
IF v#a=1 ethnic=1.
IF v#b=1 ethnic=2.
IF v#c=1 ethnic=3.
IF v#d=1 ethnic=4.
IF v#e=1 ethnic=5.
IF v#f=1 ethnic=6.
IF v#g=1 ethnic=7.
IF v#h=1 ethnic=8.
ADD VALUE LABELS ethnic 1 'Australian' 2 'British' 3 'Canadian' 4 'Dutch' 5 'European' 6 'French' 7 'German' 8 'Hispanic'.
EXE.
To set priorities, you just change the order of the IF statements. For example, for case 2 in the example data, both v#a and v#b are selected. With the above syntax, ethnic will be set to 2 as the IF statement for v#b comes after v#a. If v#a is the priority, then you would put the IF statement for v#a after v#b (and consequently after other variables for which v#a takes priority).
Related Information
Historical Number
54671
Was this topic helpful?
Document Information
Modified date:
16 April 2020
UID
swg21480953