Date: Fri, 31 Oct 2008 17:38:24 -0400
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>"
<schreier.junk.mail@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>"
<schreier.junk.mail@GMAIL.COM>
Subject: Re: Using where clause to select for range
On Fri, 31 Oct 2008 16:29:55 -0400, Rieza Soelaeman <rsoelaeman@GMAIL.COM>
wrote:
>Ok, so THAT was the problem. I was sure it was formatted as a date,
>apparently it's not numeric. Thanks, Ya and everyone!
>
>RHS
Yes, good catch Ya. I'm just wondering why it was a mystery at all, since
the problematic code generates a straightforward ERROR statement:
ERROR: Where clause operator requires compatible variables.
Demo:
data july;
year = '2008';
race = 0;
run;
proc freq data=july;
tables race*year/nocol norow nopercent;
where 1991<= year <=2001;
run;
>
>On Fri, Oct 31, 2008 at 4:28 PM, Ya Huang <ya.huang@amylin.com> wrote:
>
>> It should work. Are you sure your variable year is numeric?
>> If it's a character var, you should use:
>>
>> '1991'<= year <='2001'
>>
>> On Fri, 31 Oct 2008 16:14:08 -0400, Rieza Soelaeman <rsoelaeman@GMAIL.COM>
>> wrote:
>>
>> >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
>>
|