I see that here are 2 variations of ANY command. Let's suppose I have 3
variables in data file and q, w and e (in that order in data file)
a) One variation is I can check whether the variables q, w and e have a
particular value 2.
So I will write
if (any(2, q to e)) Flag1 = 23.
exe.
All cases which have a 2 in atleast one of the variables q to e would
have a value in flag1variable as 23.
Also if am interested in checking for variables q and e only (they are
not together in data file I may use
if (any(2, q, e)) Flag1 = 23.
exe.
b) Second variation is I can check whether a particular variable (let's
say w) has value 2 or 4 or 5 etc.. he syntax for this would be
if (any( w, 2,4, 5) flag2 = 67.
All cases which have variable w as equal to either 2 or 4 or 5 will
have the newly created flag2 variable equal to 67.
Suppose if I wanted to check for all values from 2 through 5 then if I
write
if (any( w, 2 thru 5) flag2 = 67.
yields an error, while writing it as
if (any( w, 2,3,4, 5) flag2 = 67. works without any problem (I know i
could have used if(range(w, 2, 5)) flag2 = 67. )
I would like to know as to why does SPSS allows usage of "to" in part
a) for specifying range of contiguous variables while in b) it doesnt
allow usage of "thru" for specufying contiguous values.
Regards,
Hari
India
> Hi,
>
> I see that here are 2 variations of ANY command. Let's suppose I have 3
> variables in data file and q, w and e (in that order in data file)
>
[snip, first variation]
>
> b) Second variation is I can check whether a particular variable (let's
> say w) has value 2 or 4 or 5 etc.. he syntax for this would be
>
> if (any( w, 2,4, 5) flag2 = 67.
>
> All cases which have variable w as equal to either 2 or 4 or 5 will
> have the newly created flag2 variable equal to 67.
>
> Suppose if I wanted to check for all values from 2 through 5 then if I
> write
>
> if (any( w, 2 thru 5) flag2 = 67.
>
> yields an error, while writing it as
>
> if (any( w, 2,3,4, 5) flag2 = 67. works without any problem (I know i
> could have used if(range(w, 2, 5)) flag2 = 67. )
>
> I would like to know as to why does SPSS allows usage of "to" in part
> a) for specifying range of contiguous variables while in b) it doesnt
> allow usage of "thru" for specufying contiguous values.
"thru" is used for values in Recode or Missing, where it
includes the whole range, integer or non-integer.
Do you know of somewhere that it specifies discrete values?
The any() function wants an explicit, discrete list,
and it doesn't know the keyword "thru", and it would
not be consistent with other uses if it did.
--
Rich Ulrich, wpi...@pitt.edu
http://www.pitt.edu/~wpilib/index.html