Date: Sat, 1 Nov 2008 16:36:17 -0400
Reply-To: msz03@albany.edu
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Mike Zdeb <msz03@ALBANY.EDU>
Subject: Re: Using where clause to select for range
Content-Type: text/plain;charset=iso-8859-1
hi ... once you straighten out the problem about whether you have a numeric or character variable (as pointed out in all the other postings about
this question), I'm surprised no one has suggested that you use
where year between 1991 and 2001;
given that there are so few places in SAS code that you can write something that looks sensible to even your non-SAS friends, why not use it
well I guess that maybe it might not be totally sensible since the BETWEEN actually contains the limits of the range (in this case 1991 and 2001)
if you want to retain 'puzzlement' in the code, try
where year between 2001 and 1991;
that also works
--
Mike Zdeb
U@Albany School of Public Health
One University Place
Rensselaer, New York 12144-3456
P/518-402-6479 F/630-604-1475
> Hello everyone,
> Just wondering how I can use the where clause to select for a range of
> years. For example, I want SAS to run the procedure only on observations
> from 1991-2001. I tried where 1991<= year <=2001; but that doesn't work
> :(. I really don't want to have to do where year in
> (1991,1992,1993,1994,1995,etc.); because the just seems tedious.
>
> Thanks!
> RHS
>
>