Date: Thu, 6 Jul 2006 23:34:23 -0700
Reply-To: David L Cassell <davidlcassell@MSN.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: David L Cassell <davidlcassell@MSN.COM>
Subject: Re: Converting an Age result
Content-Type: text/plain; format=flowed
>I calculated Age in the following code:
> data studythrdDOB;
> SET studythrdDOB;
> age = (date() - DOB)/365.25 ;
> And I got an output AGE that looks like 3004969.5
> Initial dob looked like 12jan1945.
> Below is the fragment of proc contents.
> # Variable Type Len Pos Format Informat
> 6 DOB Num 8 0 DATETIME20. DATETIME20.
> 68 age Num 8 288
> How can I convert the result Age in order it look like and Age (number
> Thnk you in advance,
You included the prcise clue I needed. Look at the PROC CONTENTS
output. DOB is a *datetime*, not a date. That means it is in seconds
since Jan 1 1960, not in days. So first, do this:
Now use this in your calculations.
Dividing by 365.25 is an okay approximation. Maybe. It totally depends
on your 'business case'. What does an 'age' represent? Is it like my age,
which only changes by 1 on my birthday? Is it supposed to be a
continuous variable which increases every day?
I like Billy Kreuter's formula, which is a classic. Ian already discussed
Toby knows it. He just *pretended* to flub it so he could pad his number of
posts by having to correct his 'mistake'. :-) :-) :-)
David L. Cassell
3115 NW Norwood Pl.
Corvallis OR 97330
On the road to retirement? Check out MSN Life Events for advice on how to
get there! http://lifeevents.msn.com/category.aspx?cid=Retirement