LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous (more recent) messageNext (less recent) messagePrevious (more recent) in topicNext (less recent) in topicPrevious (more recent) by same authorNext (less recent) by same authorPrevious page (March 2004, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Wed, 10 Mar 2004 17:21:38 -0500
Reply-To:     Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Subject:      Re: Selecting certain cases

There are of course many solutions.

But there are no variables A and B. I think Jim intended to code

IF 'a' IN (Var1, Var2, Var3, Var4) AND 'b' IN (Var1, Var2, Var3, Var4);

I offered a solution which avoids getting "wallpapery" when there are a lot of variables and a lot of values to check.

On Thu, 11 Mar 2004 01:07:43 +0300, =?koi8-r?Q?=22?=Paul Dorfman=?koi8-r?Q? =22=20?= <sashole@MAIL.RU> wrote:

>Howard, > >You are right, of course, but the lack in the IN functionalily can be circumvented by using SELECT instead: > >select (a) ; when (Var1, Var2, Var3, Var4) _a = 1 ; otherwise ; end ; >select (b) ; when (Var1, Var2, Var3, Var4) _b = 1 ; otherwise ; end ; >if _a and _b ; > >Kind regards, >---------------- >Paul M. Dorfman >Jacksonville, FL >---------------- > > >-----Original Message----- >From: Howard Schreier <Howard_Schreier@ITA.DOC.GOV> >To: SAS-L@LISTSERV.UGA.EDU >Date: Wed, 10 Mar 2004 15:08:22 -0500 >Subject: Re: Selecting certain cases > >> >>That would be nice, but unfortunately the operands on the right side of the >>IN operator have to be constants. >> >>Here is an approach using an array. Insert the following after then INPUT >>statement: >> >> array v(*) var : ; >> do i = 1 to dim(v); drop i; >> if v(i) not in ('a','b',' ') then delete; >> end; >> >>On Wed, 10 Mar 2004 15:09:57 +0100, Groeneveld, Jim >><jim.groeneveld@VITATRON.COM> wrote: >> >>>Hi saslist, >>> >>>Who are you? Do you have any good reason to post anonymously? >>> >>>Try the subsetting IF statement: >>>IF a IN (Var1, Var2, Var3, Var4) AND b IN (Var1, Var2, Var3, Var4); >>> >>>Regards - Jim. >>>-- >>>. . . . . . . . . . . . . . . . >>> >>>Jim Groeneveld, MSc. >>>Biostatistician >>>Science Team >>>Vitatron B.V. >>>Meander 1051 >>>6825 MJ Arnhem >>>Tel: +31/0 26 376 7365 >>>Fax: +31/0 26 376 7305 >>>Jim.Groeneveld@Vitatron.com >>>www.vitatron.com >>> >>>My computer remains home, but I will attend SUGI 2004. >>> >>>[common disclaimer] >>> >>> >>>-----Original Message----- >>>From: saslist@COMCAST.NET [mailto:saslist@COMCAST.NET] >>>Sent: Wednesday, March 10, 2004 14:15 >>>To: SAS-L@LISTSERV.UGA.EDU >>>Subject: Selecting certain cases >>> >>> >>>data test; >>>infile cards dlm=',' dsd missover; >>>input id var1 $ var2 $ var3 $ var4 $; >>>cards; >>>1,a,b,c,d >>>2,a >>>3,a,b >>>4,b.e >>>5,b,c,e,e >>>; >>> >>>This one seemed pretty simple at the start, but . . . In the above >>>simplified example, I want to select instances when records have a or b >>>only. So basically I want cases like record 2 and 3, but not 1, 4 or 5. >>>Thanks. >>


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