LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2006)Back to main SPSSX-L pageJoin or leave SPSSX-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Mon, 11 Sep 2006 22:14:19 -0400
Reply-To:     Richard Ristow <wrristow@mindspring.com>
Sender:       "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From:         Richard Ristow <wrristow@mindspring.com>
Subject:      Re: using ANY in select if
Comments: To: "Baglioni, Tony" <ajb2t@comm.virginia.edu>
In-Reply-To:  <8AE883D86DBAAF4E9924E984A06927F20315D1B5@mcintire6.comm.vi
              rginia.edu>
Content-Type: text/plain; charset="us-ascii"; format=flowed

At 10:38 AM 9/11/2006, Baglioni, Tony wrote:

>Can someone please give me an example of the use of ANY within the >select if command? I have a list of difference variables and I want >to select cases where the difference is not zero. Let me clarify. I >want to avoid saying > >SELECT IF (var1 ne 0 or var2 ne 0 or var3 ne 0 ... or var22 ne 0).

ANY isn't well suited, as you've noticed: It does an 'or' of a set of equality comparisons; you want an 'or' of a set of inequality comparisons (any value is not zero).

Jan Spousta's is a very good 'cute' solution - 'cute', meaning that it does the job nicely, but in a way that wouldn't strike one immediately from the requirement. I'd probably use it.

You can at least write the direct logic more easily with a DO REPEAT. Untested:

COMPUTE #TAKE_IT = 0. DO REPEAT TEST_VAL = var1 TO var22. . IF (TEST_VAL NE 0) #TAKE_IT = 1. END REPEAT. SELECT IF #TAKE_IT EQ 1.


Back to: Top of message | Previous page | Main SPSSX-L page