Making dummy variables in SPSS via syntax. Say race has three values, 1 2 and 3, and you want to make three dummies, race1 race2 and race3. Note that this does not work for string variables (but you can first convert the string variable to numeric and then use this procedure).
DATA LIST FREE / race. BEGIN DATA. 1 2 3 . -9 END DATA. MISSING VALUES RACE(-9). * make dummies, method 1 . COMPUTE race1=(race=1). COMPUTE race2=(race=2). COMPUTE race3=(race=3). crosstabs /tables = race by race1 /tables = race by race2 /tables = race by race3. * make dummies, method 2 . DO REPEAT A=race1 race2 race3 /B=1 2 3. COMPUTE A=(race=B). END REPEAT. crosstabs /tables = race by race1 /tables = race by race2 /tables = race by race3.