Date: Wed, 5 May 2004 12:49:29 -0400
Reply-To: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Howard Schreier <Howard_Schreier@ITA.DOC.GOV>
Subject: Re: Propagating Date Problem!
I am going to start from scratch.
Here is a shortened version of the test dataset:
input ddmmm $;
We have to assume that there are no "invisible" year rollovers; that is, no
jumps of a year or more from observation to the next.
retain year 1970;
sasdate = input(compress(ddmmm||'1919',' -'),date9.);
if sasdate < lag(sasdate) then year ++ 1;
sasdate = mdy(month(sasdate),day(sasdate),year);
format sasdate date9.;
The first assignment statement constructs a SAS date in an arbitrary year
(I chose 1919). The IF statement tests for year rollover. The second
assignment statement moves the date into the correct year.
On Tue, 4 May 2004 16:30:50 -0400, Ross, Michael D
> I have the following dates from 1970 - 2020 (an excerpt below). I need Sas
>dates - but I'm having trouble adding the year. Here's my code: Any
>retain year 1970;
>if first.month eq 'JAN' then year='1970';
> else year=year+1;