next variable

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

next variable

William-85
I an trying, without success, to build a group a variables, each based on
the sequentially on the next case in the original data.  What I've got is:

DO REPEAT S = PS1 TO PS93.
COMPUTE S = XXXX / TOT_ART.
END REPEAT.

What I need is to be able to replace the 'XXXX' with the next variable in
the original data every time so that PS1 = var1/TOT_ART, PS2 =
var2/TOT_ART,...PS93 = var93/TOT_ART for each case.  The various PS#'s are
then fed into a new equation.

Any ideas?

William.
Reply | Threaded
Open this post in threaded view
|

Re: next variable

Anton Balabanov
What about this?

DO REPEAT S = PS1 TO PS93 /var=var1 TO var93.
COMPUTE S = var / TOT_ART.
END REPEAT.

Best,
Anton

> -----Original Message-----
> From: SPSSX(r) Discussion [mailto:[hidden email]]
> On Behalf Of William
> Sent: Friday, April 13, 2007 6:59 AM
> To: [hidden email]
> Subject: next variable
>
> I an trying, without success, to build a group a variables,
> each based on the sequentially on the next case in the
> original data.  What I've got is:
>
> DO REPEAT S = PS1 TO PS93.
> COMPUTE S = XXXX / TOT_ART.
> END REPEAT.
>
> What I need is to be able to replace the 'XXXX' with the next
> variable in the original data every time so that PS1 =
> var1/TOT_ART, PS2 =
> var2/TOT_ART,...PS93 = var93/TOT_ART for each case.  The
> various PS#'s are then fed into a new equation.
>
> Any ideas?
>
> William.
>