sel if & any with ne

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

sel if & any with ne

wsu_wright
I like using the 'any' syntax when making sample restrictions (odd that
it is not documented in the reference syntax guide but I think I recall
someone saying it was an old code).  But, how can one use it with the
not equal option.

sel if any(v1,7,21,33). /* works fine.


sel if ne any(v1,7,21,33). /* does not work, any suggestions?


David

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: sel if & any with ne

David Wasserman
Try:

sel if not any(v1,7,21,33).


David Wasserman
Educational Data Consultant



-----Original Message-----
From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of David Wright
Sent: January-04-10 2:37 PM
To: [hidden email]
Subject: sel if & any with ne

I like using the 'any' syntax when making sample restrictions (odd that
it is not documented in the reference syntax guide but I think I recall
someone saying it was an old code).  But, how can one use it with the
not equal option.

sel if any(v1,7,21,33). /* works fine.


sel if ne any(v1,7,21,33). /* does not work, any suggestions?


David

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: sel if & any with ne

MaxJasper
In reply to this post by wsu_wright
sel if any(v1,7,21,33). /* works fine.
Means
sel if (any(v1,7,21,33) NE 0). /* works fine.

Try:
Sel if(any(v1,7,21,33)=0).


|
|I like using the 'any' syntax when making sample restrictions
|(odd that it is not documented in the reference syntax guide
|but I think I recall someone saying it was an old code).  But,
|how can one use it with the not equal option.
|
|sel if any(v1,7,21,33). /* works fine.
|
|
|sel if ne any(v1,7,21,33). /* does not work, any suggestions?
|
|
|David

=====================
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
Reply | Threaded
Open this post in threaded view
|

Re: sel if & any with ne

Jon K Peck
In reply to this post by wsu_wright

Jon Peck
SPSS, an IBM Company
[hidden email]
312-651-3435



From: David Wright <[hidden email]>
To: [hidden email]
Date: 01/04/2010 02:40 PM
Subject: [SPSSX-L] sel if & any with ne
Sent by: "SPSSX(r) Discussion" <[hidden email]>





I like using the 'any' syntax when making sample restrictions (odd that
it is not documented in the reference syntax guide but I think I recall
someone saying it was an old code).  But, how can one use it with the
not equal option.


>>>Any is a standard transformation function and is documented with the 200+ others.
"ANY. ANY(test,value[,value,...]). Logical. Returns 1 or true if the value of test matches any of the subsequent values; returns 0 or false otherwise."

ne is a comparison operator that requires a second value as in
any(...) ne 1
but in this case using NOT would be more natural as in
SELECT IF NOT any(...).

HTH,
Jon Peck



sel if any(v1,7,21,33). /* works fine.


sel if ne any(v1,7,21,33). /* does not work, any suggestions?


David

=====================
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


Reply | Threaded
Open this post in threaded view
|

Re: sel if & any with ne

Rick Oliver-3

In the specific example cited (and as a general form), change

sel if ne any(v1,7,21,33)

to

select if not(any(v1, 7, 21, 33)).


From: Jon K Peck/Chicago/IBM@IBMUS
To: [hidden email]
Date: 01/04/2010 04:12 PM
Subject: Re: sel if & any with ne
Sent by: "SPSSX(r) Discussion" <[hidden email]>






Jon Peck
SPSS, an IBM Company
[hidden email]
312-651-3435


From: David Wright <[hidden email]>
To: [hidden email]
Date: 01/04/2010 02:40 PM
Subject: [SPSSX-L] sel if & any with ne
Sent by: "SPSSX(r) Discussion" <[hidden email]>






I like using the 'any' syntax when making sample restrictions (odd that
it is not documented in the reference syntax guide but I think I recall
someone saying it was an old code).  But, how can one use it with the
not equal option.


>>>Any is a standard transformation function and is documented with the 200+ others.

"
ANY. ANY(test,value[,value,...]). Logical. Returns 1 or true if the value of test matches any of the subsequent values; returns 0 or false otherwise."

ne is a comparison operator that requires a second value as in

any(...) ne 1

but in this case using NOT would be more natural as in

SELECT IF NOT any(...).


HTH,

Jon Peck




sel if any(v1,7,21,33). /* works fine.


sel if ne any(v1,7,21,33). /* does not work, any suggestions?


David

=====================
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