| Date: | Wed, 19 Sep 2007 15:25:42 -0700 |
| Reply-To: | Richard Read Allen <peakstat@WISPERTEL.NET> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | Richard Read Allen <peakstat@WISPERTEL.NET> |
| Subject: | Re: RES: Finding actual age |
|
| In-Reply-To: | <200709192018.l8JIASA9031634@mailgw.cc.uga.edu> |
| Content-Type: | text/plain; charset="us-ascii"; format=flowed |
|---|
TJ,
This explanation is from an old email from Dale McLerran that I kept
on the subject. Hope it helps.
Richard
========================================================
Larry,
While the yrdif function with the "act/act" basis comes quite close
to returning correct age values, the yrdif function does not return
correct age values in some circumstances. That is, the integer
portion of age calculated employing the yrdif function can actually
be too small in some circumstances. If a person is born prior to
leap day in a non-leap year and you compute that persons age on
their birth date in a leap year (e.g., dob=2/23/1943 and we
calculate age on 2/23/1996) or if a person is born after leap day
in a leap year and we compute their age on their birth date in
a non-leap year (e.g., dob=6/1/1944 and we calculate age on
6/1/1995), then the integer part of the age will be too small.
If it is required to always return the integer part of the age
correctly, then you must use something other than the yrdif function.
I, and several others, have posted Billy Kreuter's most excellent
approach to computing age all wrapped up in a macro. You may not
remember the details of how the macro works, but if you have the
macro at your disposal, then computing age is simple. See
http://listserv.uga.edu/cgi-bin/wa?A2=ind0407E&L=sas-l&P=R4242
for one instance of the macro.
Dale
At 01:18 PM 9/19/2007, T J wrote:
>On Wed, 19 Sep 2007 20:07:53 +0000, toby dunn <tobydunn@HOTMAIL.COM>
>wrote: ====IN PART ============
>
> >T J ,
> >
> >YrDif Function does have some pitfalls and it will only check the number of
> >years between the birth year and the ending year. In other words you could
> >be adding an extra year to someone because the ending year is before their
> >actialy birthdate. Under optimal conditions calculating age this was is a
> >rough approximation at best.
> >
> >
>
>Can you show me an example for the situation you mentioned above?
>
>I would be interested to know the other pitfalls of this function as well.
>
>-TJ
|