SPSS - does anyone know how to create loops and create new variables in a dataset?

Asked

Viewed 76 times

2

Does anyone know how to create loops and that these loops create new variables in a dataset? if possible using SPSS Syntax or some other software function.

1 answer

2


Opa, vc has to vector its 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: http://www-01.ibm.com/support/docview.wss?uidswg21476044

  • very good guy ... vlws by help.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.