I'm trying to combine a set of "select-all-that-apply" variables into one variable from a dataset downloaded from Qualtrics.
As it stands, Qualtrics creates a variable for each possible choice, assigning a "1" if a respondent selected it and a "." for missing if a respondent didn't select it.
In this particular instance (racial categories), I just duplicated each variable, assigned a unique number to each variable for a "selected," (e.g., white selected value of 1 converted to 100), and then added all the duplicated variables together into a new variable. This gave each case a unique number that may or may not have represented multiple racial categories.
So the new labels for a respondent who checked multiple answer choices looked something like "White AND Asian," instead of a "1" in each of those individual variables, for example.
I was thinking, though, that there's probably an easier way to do this?
EDIT: Syntax included below.
Recode into race variable with unique value for each selection
RECODE w1srace_1 (1=1) (ELSE=Copy) INTO r2w1srace_1.
VARIABLE LABELS r2w1srace_2 'recoded to higher values'.
EXECUTE.
RECODE w1srace_2 (1=5) (ELSE=Copy) INTO r2w1srace_2.
VARIABLE LABELS r2w1srace_2 'recoded to higher values'.
EXECUTE.
RECODE w1srace_3 (1=10) (ELSE=Copy) INTO r2w1srace_3.
VARIABLE LABELS r2w1srace_3 'recoded to higher values'.
EXECUTE.
RECODE w1srace_4 (1=20) (ELSE=Copy) INTO r2w1srace_4.
VARIABLE LABELS r2w1srace_4 'recoded to higher values'.
EXECUTE.
RECODE w1srace_5 (1=50) (ELSE=Copy) INTO r2w1srace_5.
VARIABLE LABELS r2w1srace_5 'recoded to higher values'.
EXECUTE.
RECODE w1srace_6 (1=100) (ELSE=Copy) INTO r2w1srace_6.
VARIABLE LABELS r2w1srace_6 'recoded to higher values'.
EXECUTE.
RECODE w1srace_7 (1=200) (ELSE=Copy) INTO r2w1srace_7.
VARIABLE LABELS r2w1srace_7 'recoded to higher values'.
EXECUTE.
RECODE w1srace_8 (1=500) (ELSE=Copy) INTO r2w1srace_8.
VARIABLE LABELS r2w1srace_8 'recoded to higher values'.
EXECUTE.
**Create new combined race variable**
COMPUTE r3w1srace=sum(r2w1srace_1,r2w1srace_2,r2w1srace_3,r2w1srace_4,r2w1srace_5,r2w1srace_6,r2w1srace_7,r2w1srace_8).
EXECUTE.