|
Hi:
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 (var0040 = 1 and v0047 = 2) clean = 1. if (var0050 = 1 and v0057 = 2) clean = 1. ... ... ... if (var0750 = 1 and v0757 = 2) clean = 1. As you can see it's a fairly long syntax, and as you can see var0010 increases by 10 every step for 75 steps until reaching var0750. 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. Regards. ===================== 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 |
|
Hi,
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. HTH -- Raynald Levesque www.spsstools.net On Jan 29, 2008 6:04 PM, Juan Pablo Sandoval <[hidden email]> wrote: > Hi: > > 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 (var0040 = 1 and v0047 = 2) clean = 1. > if (var0050 = 1 and v0057 = 2) clean = 1. > ... > ... > ... > if (var0750 = 1 and v0757 = 2) clean = 1. > > As you can see it's a fairly long syntax, and as you can see var0010 > increases by 10 every step for 75 steps until reaching var0750. 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. > > Regards. > > ===================== > 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 |
|
In reply to this post by Juan Pablo Sandoval
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. END REPEAT. ===================== 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 |
| Free forum by Nabble | Edit this page |
