Date: Tue, 12 May 2009 14:35:15 -0400
Reply-To: Croghan.Carry@EPAMAIL.EPA.GOV
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Carry Croghan <Croghan.Carry@EPAMAIL.EPA.GOV>
Subject: Re: Date Comparison
In-Reply-To: <200905121628.n4CAlU0g010811@malibu.cc.uga.edu>
Content-type: text/plain; charset=US-ASCII
just an aside, one of the nice things about the structure of the
yyyymmdd format of dates is that you can do a comparison between the
values without having to translate into SAS date values.
But to do the within two weeks that does require translation.
Date8. format is different it is ddMONyy.
Your dates are formatted as yymmddn8.
Others have been very helpful on how to input the data and do the
comparison so I won't waste time with that.
Carry W. Croghan
Database Manager
EPA\ORD\NERL\HEASD
RTP, NC
From: Michael Bryce Herrington <mherrin@G.CLEMSON.EDU>
To: SAS-L@LISTSERV.UGA.EDU
Date: 05/12/2009 12:28 PM
Subject: Date Comparison
Hey,
I would like to compare dates of certain variables. My dates were input
as
numbers however. So first questions is to reformat the as dates will
something like this work? They are in the date8. form I think, ie.
20040517
data test;
set data;
input(tdydate,date8.)
input(lastracedate,date8.)
.
.
.
run;
The next thing I want to do is make a binary variable, recentrace, that
will
be 1 if the last race was within 2 weeks, 0 otherwise.
Sample data (I will leave it as numbers like how it is for me now).
data sample;
input date lastdaterace;
datalines;
20040517 20040412
20050903 20050215
20050319 20050312
;
run;
THANKS
--
Bryce Herrington
Clemson University
111 Briar Lane
Central, SC 29630
mherrin@g.clemson.edu
(863) 258-4758