1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
*(Q)I have been trying to create a series of
new variables based on the values in some existing variables.  Simply, I am
transforming a multi-response question into several single response
questions.  And the multi-response question is structured as like "first
come, first in" in 30 columns.  The responses are not necessarily in order.

*(A) Posted to SPSSX-L list by Raynald Levesque on 2002/07/01.
* Visit Raynald's SPSS Tools at http://pages.infinit.net/rlevesqu/index.htm

DATA LIST LIST /id r1 r2 r3 r4 r5 r6 r7 r8 r9 r10.
BEGIN DATA.
1 3 5 4 7 8 . . . .
2 5 7 9 4 . . . . .
3 5 2 6 4 1 9 8 . .
END DATA.
LIST.
 
VECTOR c(10).
DO REPEAT val=1 2 3 4 5 6 7 8 9 10
 /r=r1 to r10
 /c=c1 TO c10.
COMPUTE c=ANY(val,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10).
END REPEAT.
EXECUTE.