Date: Thu, 18 Nov 1999 09:52:17 -0500
Reply-To: ABELSOR <ABELSOR@WESTAT.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: ABELSOR <ABELSOR@WESTAT.COM>
Subject: Re: Simple Date Problem
Content-Type: text/plain; charset=US-ASCII
You can use functions in WHERE statements (at least since SAS 6.11 IIRC):
1 /* Code tested using 6.12 TS060, Windows 95 */
2 data temp;
3 do date=3000 to 5000;
4 output;
5 end;
6 run;
NOTE: The data set WORK.TEMP has 2001 observations and 1 variables.
NOTE: The DATA statement used 0.28 seconds.
7 proc print data=temp;
8 where year(date)=1971;
9 format date date9.;
10 run;
HTH
Bob
______________________________________________________________________
|Bob Abelson |"Original thought is like original sin -|
|Westat |both happened before you were born to |
|An Employee-Owned Research |people you could not possibly have met."|
|Corporation | |
|ABELSOR@westat.com |- Fran Lebowitz |
|_____________________________|________________________________________|
____________________Reply Separator____________________
Subject: Simple Date Problem
Author: Minsup Song <msong@SYR.EDU>
Date: 11/19/1999 7:08 AM
Dear
Hello. I have a simple(?) problem. In the data set, there are date (year)
variable. For example,
OBS Date
1 1970
2 1971
3 1973
... ...
I would like to extract some observation by Date. For example, I would like
to extract observation of which date is 1971. But unfortunately, when I
enter the command as below,
Data temp;
Set Above;
If Date=1970;
Run;
Then, there is no observation. I find out why. The date is formatted by
the date of 1960. 1.1. For example, when I give the range like below,
Proc Print Data=Temp;
Where 3000<=Date<=5000;
Run;
I can see observations of which date is about 1970s. How can I treat this
variable? Can I use the Date variable more easily?
Thank you.