Date: Wed, 30 Jan 2008 00:51:19 -0500
Reply-To: Richard Ristow <firstname.lastname@example.org>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Richard Ristow <email@example.com>
Subject: Re: Macro or Loop to minimize Syntax
In-Reply-To: <firstname.lastname@example.org m>
Content-Type: text/plain; charset="us-ascii"; format=flowed
At 06:04 PM 1/29/2008, Juan Pablo Sandoval wrote:
>I'm running a validation syntax such as this:
> if (var0010 = 1 and v0017 = 2) clean = 1.
> if (var0020 = 1 and v0027 = 2) clean = 1.
> if (var0750 = 1 and v0757 = 2) clean = 1.
>I don't know if there is some kind of syntax doing a loop of some
>kind to save space and get the same results.
At 07:21 PM 1/29/2008, Raynald Levesque suggested:
>Assuming variables var0010 var0020 ... var0750 are consecutive in the data
>file and v0017 v0027 ... v0757 are consecutive in the data file, the command
>COMPUTE clean=ANY(1,var0010 TO var0750) AND ANY(2,v0017 TO v0757).
>does the job.
I don't think that'll quite do it, as the original logic required a 1
and a 2 value for some matched pair of variables, not simply for any
variables in the two sets. But, on the same assumptions, this should:
DO REPEAT varXXX0 = var0010 TO var0750
/vXXX7 = v0017 TO v0757.
. if (varXXX0 = 1 and vXXX7 = 2) clean = 1.
To manage your subscription to SPSSX-L, send a message to
LISTSERV@LISTSERV.UGA.EDU (not to SPSSX-L), with no body text except the
command. To leave the list, send the command
For a list of commands to manage subscriptions, send the command