Date: Wed, 2 Jul 1997 11:20:18 -0800
Reply-To: Jack Hamilton <Jack_Hamilton@HCCOMPARE.COM>
Sender: "SAS(r) Discussion" <SAS-L@UGA.CC.UGA.EDU>
From: Jack Hamilton <Jack_Hamilton@HCCOMPARE.COM>
Organization: HealthCare COMPARE Corporation
Subject: Age macro (was: Re: merging mothers and babies)
Content-Type: text/plain; charset=us-ascii
David Yeates <david.yeates@HEALTH-CARE-EPIDEMIOLOGY.OXFORD.AC.UK> wrote:
> The age can be calculated using the (well known ?) macro :-
> %macro age(birth, refer);
> where birth and refer are the appropriate dates.
> I am afraid I can't remember whom to give credit for this macro but
> it has been around for some time now.
My notes give credit to Billy Kreuter at the UofW.
Here's a related macro for calculating the age as used in Medicare,
which is the oldest age a person will have during the month
containing the reference date, rather than their age on the
/*DOC STARTDOC Macros mcareage
/*DOC The MCAREAGE macro calculates an age in years given a birthdate
/*DOC reference date as SAS date values. The age returned will be the
/*DOC age the person would be on the last day of the month of the
/*DOC reference date.
/*DOC This macro call is used as a function.
/*DOC data _null_;
/*DOC dob = '14FEB23'd;
/*DOC from = '12FEB55'd;
/*DOC age = %age(dob, from);
/*DOC mcareage = %mcareage(dob, from);
/*DOC put age= mcareage=;
/*DOC would print
/*DOC AGE=31 MCAREAGE=32
/*DOC Macro from Billy Kreuter, UofW, via SAS-L.
/*DOC ENDDOC */
%macro mcareage(birthday, refdate);
(int(intck('month', &birthday., intnx('MONTH', &refdate, 1)-1)/12))
By the way, Netscape wants to wrap input lines much sooner than I want
it to. It does this only when the message is sent, so I have to guess
how long to make the lines. Does anyone know how to defeat this
behavior? There's no LineSize setting in the options menu.
HealthCare COMPARE Corp.
West Sacramento, CA