Loops needed

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

Loops needed

Jim Moffitt
Assuming the recoded variables (Q16_1 through Q16_3) are contiguous in
my file, how could the following syntax be written to avoid the cut and
paste approach that I've employed?
 
Thanks for your help.
 
DO IF (Q12=2) .

RECODE

  Q16_1

  (SYSMIS=0)  (ELSE=Copy)  INTO  Q16_1RebaseRcd .

END IF .

EXECUTE .

 

DO IF (Q12=2) .

RECODE

  Q16_2

  (SYSMIS=0)  (ELSE=Copy)  INTO  Q16_2RebaseRcd .

END IF .

EXECUTE .

 

DO IF (Q12=2) .

RECODE

  Q16_3

  (SYSMIS=0)  (ELSE=Copy)  INTO  Q16_3RebaseRcd .

END IF .

EXECUTE .

 

====================To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Loops needed

Art Kendall-2
DO IF (Q12 eq 2) .
RECODE
  Q16_1 to q16_3
  (SYSMIS=0)  (ELSE=Copy)  INTO  Q16_1RebaseRcd Q16_2RebaseRcd
Q16_3RebaseRcd  .
END IF .
EXECUTE .


"Q16_1RebaseRcd Q16_2RebaseRcd Q16_3RebaseRcd " could be "RebaseRcdQ16_1
to RebaseRcdQ16_3"

Art Kendall
Social Research Consultants

Jim Moffitt wrote:

> Assuming the recoded variables (Q16_1 through Q16_3) are contiguous in
> my file, how could the following syntax be written to avoid the cut and
> paste approach that I've employed?
>
> Thanks for your help.
>
> DO IF (Q12=2) .
>
> RECODE
>
>   Q16_1
>
>   (SYSMIS=0)  (ELSE=Copy)  INTO  Q16_1RebaseRcd .
>
> END IF .
>
> EXECUTE .
>
>
>
> DO IF (Q12=2) .
>
> RECODE
>
>   Q16_2
>
>   (SYSMIS=0)  (ELSE=Copy)  INTO  Q16_2RebaseRcd .
>
> END IF .
>
> EXECUTE .
>
>
>
> DO IF (Q12=2) .
>
> RECODE
>
>   Q16_3
>
>   (SYSMIS=0)  (ELSE=Copy)  INTO  Q16_3RebaseRcd .
>
> END IF .
>
> EXECUTE .
>
>
>
> ===================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD
Reply | Threaded
Open this post in threaded view
|

Re: Loops needed

Jim Moffitt
Thank you, Art. This really helps a great deal.

-----Original Message-----
From: Art Kendall [mailto:[hidden email]]
Sent: Tuesday, February 05, 2008 2:17 PM
To: Moffitt, James (West)
Cc: [hidden email]
Subject: Re: Loops needed

DO IF (Q12 eq 2) .
RECODE
  Q16_1 to q16_3
  (SYSMIS=0)  (ELSE=Copy)  INTO  Q16_1RebaseRcd Q16_2RebaseRcd
Q16_3RebaseRcd  .
END IF .
EXECUTE .


"Q16_1RebaseRcd Q16_2RebaseRcd Q16_3RebaseRcd " could be "RebaseRcdQ16_1

to RebaseRcdQ16_3"

Art Kendall
Social Research Consultants

Jim Moffitt wrote:
> Assuming the recoded variables (Q16_1 through Q16_3) are contiguous in
> my file, how could the following syntax be written to avoid the cut
and

> paste approach that I've employed?
>
> Thanks for your help.
>
> DO IF (Q12=2) .
>
> RECODE
>
>   Q16_1
>
>   (SYSMIS=0)  (ELSE=Copy)  INTO  Q16_1RebaseRcd .
>
> END IF .
>
> EXECUTE .
>
>
>
> DO IF (Q12=2) .
>
> RECODE
>
>   Q16_2
>
>   (SYSMIS=0)  (ELSE=Copy)  INTO  Q16_2RebaseRcd .
>
> END IF .
>
> EXECUTE .
>
>
>
> DO IF (Q12=2) .
>
> RECODE
>
>   Q16_3
>
>   (SYSMIS=0)  (ELSE=Copy)  INTO  Q16_3RebaseRcd .
>
> END IF .
>
> EXECUTE .
>
>
>
> ===================
> To manage your subscription to SPSSX-L, send a message to
> [hidden email] (not to SPSSX-L), with no body text except
the
> command. To leave the list, send the command
> SIGNOFF SPSSX-L
> For a list of commands to manage subscriptions, send the command
> INFO REFCARD
>
>
>

=====================
To manage your subscription to SPSSX-L, send a message to
[hidden email] (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
SIGNOFF SPSSX-L
For a list of commands to manage subscriptions, send the command
INFO REFCARD