SPSS IN() Function?

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

SPSS IN() Function?

Craig Johnson
SAS has a function which allows you to do something like 

PROC SQL;
SELECT * 
FROM WHATEVER 
WHERE VAR1 IN ('A','B');
QUIT;

Does SPSS have something equivalent to the In() function?  

Conceptually like.....
SELECT IF VAR1 IN ('A','B') ?  





Reply | Threaded
Open this post in threaded view
|

Re: SPSS IN() Function?

Bruce Weaver
Administrator
SPSS has the ANY function.  It can look for a list of values within a single variable, like this:

SELECT IF ANY(VAR1,'A','B').

Or it can look for a single value within a list of variables, like this:

SELECT IF ANY(5,Var1, Var2, Var3).

HTH.


Craig Johnson wrote
SAS has a function which allows you to do something like

PROC SQL;
SELECT *
FROM WHATEVER
WHERE VAR1 IN ('A','B');
QUIT;

Does SPSS have something equivalent to the In() function?

Conceptually like.....
SELECT IF VAR1 IN ('A','B') ?
--
Bruce Weaver
bweaver@lakeheadu.ca
http://sites.google.com/a/lakeheadu.ca/bweaver/

"When all else fails, RTFM."

PLEASE NOTE THE FOLLOWING: 
1. My Hotmail account is not monitored regularly. To send me an e-mail, please use the address shown above.
2. The SPSSX Discussion forum on Nabble is no longer linked to the SPSSX-L listserv administered by UGA (https://listserv.uga.edu/).
Reply | Threaded
Open this post in threaded view
|

Re: SPSS IN() Function?

Craig Johnson
In reply to this post by Craig Johnson
That should be the ticket thanks!

On Wed, May 16, 2012 at 12:21 PM, Craig J <[hidden email]> wrote:
SAS has a function which allows you to do something like 

PROC SQL;
SELECT * 
FROM WHATEVER 
WHERE VAR1 IN ('A','B');
QUIT;

Does SPSS have something equivalent to the In() function?  

Conceptually like.....
SELECT IF VAR1 IN ('A','B') ?