Take an example when we have a series of 10 categorical variables var1, var2,..., var10
which take values from 1 to 5.
We create 5 dummy variables from each of these variables. For example, from var1
we generate dumvar1_1,..., dumvar1_5
. A dummy will receive the value of 1 if the original variable has the corresponding value with the dummy's order. That is, dumvar1_1 = 1 if var1 = 1
; dumvar1_1 = 0
otherwise. Likewise, dumvar1_2 = 1 if var1 = 2
; dumvar1_2 = 0
otherwise. The same with other dummies.
If I do in Stata, I will do like this:
forvalues i = 1(1)10 {
forvalues j = 1(1)5 {
generate dumvar`i'_`j' = 0
replace dumvar`i'_`j' = 1 if var`i' == `j'
}
}
Is there a way to do the same in SPSS?