Date: Fri, 18 Jan 2002 08:36:39 -0500
Reply-To: "Chakravarthy, Venky" <Venky.Chakravarthy@PFIZER.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: "Chakravarthy, Venky" <Venky.Chakravarthy@PFIZER.COM>
Subject: Re: age calculations etc
Content-Type: text/plain; charset="iso-8859-1"
David,
There are two new DATE functions that allow a more direct way of calculating
what you want.
16 data _null_ ;
17 birth = "21jan1929"d ;
18 refer = today() ;
19 age = int(yrdif(birth,refer,'ACT/ACT')) ;
20 days = datdif(birth,refer,'ACT/ACT') ;
21 put age = days = ;
22 run ;
AGE=72 DAYS=26660
Kind Regards,
Venky
#****************************************#
# E-mail: venky.chakravarthy@pfizer.com #
# swovcc@hotmail.com #
# Phone: (734) 622-1963 #
#****************************************#
-----Original Message-----
From: David Yeates [mailto:david.yeates@UHCE.OX.AC.UK]
Sent: Friday, January 18, 2002 7:24 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: age calculations etc
Hi All,
I have been puzzling over the following...
Given the birth-date and another reference date refer-date I can calculate
the exact age using that old favourite macro
%macro age(birth, refer);
int((intck('month',&birth,&refer)-(day(&birth)>day(&refer)))/12);
%mend age;
where &birth and &refer are the two dates. Now what I need having
calculated the age is exactly how many days are there from the birthday in
the year corresponding to refer-date to refer-date itself.
Any ideas very welcome.
Kind regards
David
UHCE, Oxford University
|