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 (April 2006, week 3)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 19 Apr 2006 13:16:34 -0400
Reply-To:   Ed Heaton <EdHeaton@WESTAT.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Ed Heaton <EdHeaton@WESTAT.COM>
Subject:   Re: data step vs Proc sql
Comments:   To: iw1junk@comcast.net
Content-Type:   text/plain; charset="US-ASCII"

Ian, Yes, I tested that. However, the WHEN in the SELECT works otherwise like it has an implied IN operator. That is, it allows... When (1,2,3.5) do something ; I'm just disappointed that it doesn't cover the integer list. Ed

Edward Heaton, SAS Senior Systems Analyst, Westat (An Employee-Owned Research Corporation), 1600 Research Boulevard, RW-4541, Rockville, MD 20850-3195 Voice: (301) 610-4818 Fax: (301) 294-3879 mailto:EdHeaton@Westat.com <mailto:EdHeaton@Westat.com> http://www.Westat.com <http://www.westat.com/>

-----Original Message----- From: iw1junk@comcast.net [mailto:iw1junk@comcast.net] Sent: Wednesday, April 19, 2006 11:56 AM To: SAS(r) Discussion Cc: Ed Heaton Subject: Re: data step vs Proc sql Ed, When (1:5) put x= "is small." ; does not work because it is based on a misunderstanding. The colon operator in this case is a property of the IN operator. select ; When (x in (1:5)) put x= "is small." ; works fine. Ian Whitlock ================ Date: Wed, 19 Apr 2006 10:43:09 -0400 Reply-To: Ed Heaton <EdHeaton@WESTAT.COM> Sender: "SAS(r) Discussion" From: Ed Heaton <EdHeaton@WESTAT.COM> Subject: Re: data step vs Proc sql Comments: To: "Dorfman, Paul" <paul.dorfman@FCSO.COM> Content-Type: text/plain; charset="US-ASCII" Paul, Since we are on the topic of WHEN statements... I was disappointed to learn recently that the following code would not work. Data test ; Do x=1 to 15 by 0.5 ; Output ; End ; Run ; Data new ; Set test ; If ( x in (1:10) ) ; Select (x) ; When (1:5) put x= "is small." ; Otherwise put x= "is large." ; End ; Run ; This bombs on the WHEN statement. The following DATA step subsets just fine. Data new ; Set test ; If ( x in (1:10) ) ; Run ; Now, the WHERE statement doesn't process the integer list but rather it returns an error. Data new ; Set test ; Where ( x in (1:10) ) ; Run ; So, here is a case where an expression works in the IF statement but doesn't work in the WHERE or WHEN statement.

Ed Edward Heaton, SAS Senior Systems Analyst, Westat (An Employee-Owned Research Corporation), 1600 Research Boulevard, RW-4541, Rockville, MD 20850-3195 Voice: (301) 610-4818 Fax: (301) 294-3879 mailto:EdHeaton@Westat.com http://www.Westat.com

<snip>


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