I want to tackle the following problem:
I have 10 variables with 5 values (1 to 5). I want to recode these 10
variables in 10 new variables with only 3 values (1 to 3) whereby 1 and 2
are converted into 1 / 3 is converted into 2 and 4 and 5 are converted into
3. I do not want to repeat the RECODe-code ten times so I want to use loops.
I used the following program to do this:
* The existing variables.
VECTOR VAR= v1001 TO v1005 .
* The new variables .
VECTOR SCH = SCH1 TO SCH10.
LOOP #I = 1 to 10.
+ DO REPEAT A= 1 2 3 4 5 / B = 1 1 2 3 3.
+ RECODE VAR(#I) (A=B) INTO SCH(#I).
+ END REPEAT PRINT.
END LOOP.
EXECUTE.
The problem is that SPSS does not subsitute the variable names from the
vectors within the DO REPEAT loop. Anybody an idea how I can resolve this ?
Thanks,
Dimitri Mortelmans
Hope this helps.
Art
A...@DrKendall.org
University Park, MD USA