Date: Wed, 6 Sep 2006 14:10:43 -0400
Reply-To: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Howard Schreier <hs AT dc-sug DOT org>" <nospam@HOWLES.COM>
Subject: Re: time with missing year
As Mark demonstrated, you can use any arbitrary year.
However, the result could be off by one day if you use the wrong type of
arbitrary year (type being leap or non-leap) and the interval of interest
within the year spans the end of February.
On Wed, 6 Sep 2006 07:43:44 -0700, Terjeson, Mark <Mterjeson@RUSSELL.COM> wrote:
>Hi Jeff,
>
>
>data d1;
> input year1 month1 day1
> year2 month2 day2;
>cards;
>2006 7 10 2006 10 5
>. 6 30 . 12 4
>. 3 2 . 8 10
>;
>run;
>
>data d2;
> set d1;
> date1 = mdy(month1,day1,max(year1,2006));
> date2 = mdy(month2,day2,max(year2,2006));
> diff = intck('day',date1,date2);
> put _all_;
>run;
>
>
>
>
>Hope this is helpful,
>Mark Terjeson
>
>
>
>-----Original Message-----
>From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of JP
>Sent: Wednesday, September 06, 2006 7:31 AM
>To: SAS-L@LISTSERV.UGA.EDU
>Subject: time with missing year
>
> I have a data set with some missing value in year data d1; input year1
>month1 day1 year2 month2 day2 cards;
> 2006 7 10 2006 10 5
> . 6 30 . 12 4
> . 3 2 . 8 10
>
>;
>I want to calculate the days between year2 month2 day2 and year1 month1
>day1.
> if any year value is missing i suppose year2=year1.
>how can I do it?
>
>Thanks
>
>Jeff
|