Date: Thu, 6 May 2004 09:10:08 -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: In Operator with numbers
Content-Type: text/plain
Mike, et al;
A note on this: the colon specifies all INTEGERS in the range. That is,
if x in ( 1:5) ;
tests true for values of x in {1,2,3,4,5} but not for 1.32.
Ed
Edward Heaton, SAS Senior Systems Analyst,
Westat (An Employee-Owned Research Corporation),
1600 Research Boulevard, RW-3541, Rockville, MD 20850-3195
Voice: (301) 610-4818 Fax: (301) 610-5128
mailto:EdHeaton@Westat.com http://www.Westat.com
-----Original Message-----
From: Michael S. Zdeb [mailto:msz03@HEALTH.STATE.NY.US]
Sent: Thursday, May 06, 2004 8:43 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Re: In Operator with numbers
Bonjour (practicing for SUGI)...
I' m not sure if anyone mentioned this yet. In V9, numeric ranges are
allowed with the IN operator, but the range requires a COLON...
data test;
length in_out $3;
input x @@;
if x in (1:5 10:14) then in_out='IN';
else in_out = 'OUT';
datalines;
1 2 8 9 12 13
;
run;
proc print data=test;
run;
Obs in_out x
1 IN 1
2 IN 2
3 OUT 8
4 OUT 9
5 IN 12
6 IN 13
Mike Zdeb
U@Albany School of Public Health
1 University Drive
Rensselaer, NY 12144-3456
(P)518-402-6479
(F)630-604-1475