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