Date: Wed, 4 Jan 2006 12:21:21 -0800
Reply-To: Eric Hoogenboom <erichoogenboom@YAHOO.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: Eric Hoogenboom <erichoogenboom@YAHOO.COM>
Subject: Re: AW: Re: Date interval format yy.ddd
Content-Type: text/plain; charset="iso-8859-1"
Thanks for checking. If someone born on a leap day asks me when he can
start driving a car in Wales, I know the answer. :-)
I guess my code isn't so bad, except that it has a problem around the
start of the 22nd century. My daughter may live to
meet that challenge (maybe retirement starts at 97 then) and update it.
Tomas, everything may be much more simple when we move to Pluto.
Disadvantage: no more birthday parties.
That's all for now,
> I checked with the Driver and Vehicle licencing authority in the UK and
> they told me that a person is a year older at one minute past midnight
> of the day before their birthday. So if you were born on 29th Feb then
> on a non-leap year you would be a year older at one minute past
> midnight of the 28th Feb which would be one minute into 1st March.
> magnusson tomas wrote:
> > Eric,
> > my personal opinion is that you are not yet one year older in your example and jumps directly to x year and 1 day
> > in March 1. In this case we don't have any x years and 0 days.
> > It would be much easier if we quit counting years since we are born, but only celebrating even number of days, let's say periods of every 400 days
> > (or better 300) ;-). Then we wouldn't have any problems with the leapyears...
> > Tomas
> > -----Ursprüngliche Nachricht-----
> > Von: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU]Im Auftrag von
> > Eric Hoogenboom
> > Gesendet: Dienstag, 3. Januar 2006 16:19
> > An: SAS-L@LISTSERV.UGA.EDU
> > Betreff: Re: Date interval format yy.ddd
> > Tomas,
> > It is puzzle time, apparently. Below the code that should _almost_ do
> > the trick. The last observation is a puzzle to me: how many years have
> > you grown to be when born on feb 29th of a leap year and died on feb
> > 28th of a non leap year.
> > Hth
> > Eric
> > data young_people;
> > input Born : date9. Died : date9.;
> > years = year(died) - year(born) -
> > (put(died, mmddyy4.) < put(born, mmddyy4.));
> > if put(born, mmddyy4.) = '0229' and (mod(years, 4) > 0) then
> > lastbirthday = mdy(2, 28, year(born)+years);
> > else
> > lastbirthday = mdy(month(born), day(born), year(born)+years);
> > days = died - lastbirthday;
> > age = years + days/1000;
> > format born died lastbirthday date9. age 8.3;
> > put born= died= lastbirthday= age=;
> > cards;
> > 04DEC1980 05DEC2004
> > 06DEC1980 05DEC2004
> > 06DEC1980 05DEC2005
> > 06DEC1980 05DEC2004
> > 29FEB1976 03JAN2006
> > 29FEB1976 28FEB2004
> > 29FEB1976 29FEB2004
> > 29FEB1976 01MAR2004
> > 29FEB1976 01MAR2005
> > 29FEB1976 28FEB2005
> > ;