Does anyone know how to create repeating loops and that this loops create new variables in a dataset? if possible using SPSS Syntax or some other function of the software.
Does anyone know how to create repeating loops and that this loops create new variables in a dataset? if possible using SPSS Syntax or some other function of the software.
Oops, you have to vectorize your table and then associate the loop with the vectors:
Example:
* Programs to construct a SET of difference scores and sum scores .
VECTOR X(4) / Y(4) .
DO REPEAT V= V1 TO V4 / W = W1 TO W4 / X = X1 TO X4 / Y = Y1 TO Y4.
COMPUTE X = V + W.
COMPUTE Y = V - W.
END REPEAT .
VECTOR V = V1 TO V4 / W = W1 TO W4 / X(4) / Y(4) .
LOOP I = 1 to 4 .
COMPUTE X(I) = V(I) + W(I) .
COMPUTE Y(I) = V(I) - W(I) .
END LOOP .
link to this and other examples: link