Date: Wed, 23 Feb 2005 18:44:40 -0500
Reply-To: Richard Ristow <email@example.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Richard Ristow <firstname.lastname@example.org>
Subject: Re: select cases with Multiple variables in a range
Content-Type: text/plain; charset="us-ascii"; format=flowed
At 02:46 PM 2/23/2005, Hector Maletta wrote:
>You are right, sorry for the new mistake. ANY evaluates whether any of
>SEVERAL values appears in ONE variable. It cannot evaluate whether ONE
>value appears in any of SEVERAL variables.
Actually, it can do the latter just fine. The syntax manual says,
"ANY(arg,arg list): Return 1 or true if the value of the first argument
matches one of the arguments in the list; return 0 or false if not. The
first argument is usually a variable, either numeric or string. For
example, ANY(PROJECT,3,4,7,9) returns 1 if the value for variable
PROJECT is 3, 4, 7, or 9, and 0 for other values of PROJECT."
But since any of the arguments can be constants or variables,
ANY(2,RESP1 TO RESP5) /* Or other value and variables */
is accepted, and very handy to test for the occurrence of a constant
value among a set of variables.
>[So,] to select the cases which have the code '250 - 260' in at least
>one of the variables [V1 through V9]',
SELECT IF ANY('250 - 260',V1 TO V9).
(WARNING: A code like '250 - 260', with the spaces, is very easy to
enter wrong. There's every chance you'll miss cases you wanted,
because of syntax errors in the values.)
Now, to evaluate whether any of SEVERAL values appear in any of SEVERAL
variables, you do need COUNT. If you want cases where any of V1 to V9
(which must be *numeric* variables) have any of the values 250-260,
COUNT GOOD_VAL = V1 to V9(250 THRU 260).
SELECT IF (GOOD_VAL > ).