LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (September 2006, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:         Fri, 8 Sep 2006 00:07:01 +0000
Reply-To:     iw1junk@COMCAST.NET
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Ian Whitlock <iw1junk@COMCAST.NET>
Subject:      Re: time with missing year
Comments: cc: hs@HOWLES.COM, "Terjeson, Mark" <Mterjeson@RUSSELL.COM>

Howard,

There are more problems than one day off when you consider more

test data. data d1; input year1 month1 day1 year2 month2 day2; cards; 2006 7 10 2006 10 5 . 8 10 . 3 2 . 2 29 . 4 30 ; run;

The second observation says the assumption of the same year is false! The third record says the year must be a leap year.

Ian Whitlock ================= 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" 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] On Behalf Of JP >Sent: Wednesday, September 06, 2006 7:31 AM >To: SAS-L >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


Back to: Top of message | Previous page | Main SAS-L page