Focal Point
CLOSED - Calculate Age for People Turning 65 In 90 Days

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/9637089966

April 03, 2014, 04:34 PM
ChadSS
CLOSED - Calculate Age for People Turning 65 In 90 Days
I need to find members of a population who will be turning 65 within the next 90 days. At first this sounded simple, but as I got into the code I realized this is a little more complex than I originally thought. I have the individuals dates of birth and I have successfully calculated the correct age, but it is the ‘turning 65 within 90 days’ that is throwing me off.

Any suggestions on calculating a persons age on a future date?

This message has been edited. Last edited by: ChadSS,
April 03, 2014, 05:02 PM
Jump_faster
Lets convert years into days.
65 years = 65*365 days = 23725 days

Now lets work backwards; 23725 days - 90 days = 23635 days.

If a person current age is greater than or equal to 23635 days then they will turn 65 within 90 days


WebFOCUS 7.7. Windows Server 2008. All Outputs.

WEBFOCUS 7.6.11. Windows Server 2003. All Outputs.
April 03, 2014, 06:07 PM
j.gross
So their 90th bday would fall in the range (today+1, today+90), right? In order to retrieve records where date of birth is in the appropriate range, you'll need to calculate those two 90-th bday end-point date values (say as &date1, &date2), subtract 90 years from each (&date3, date4), and apply

where dob from '&date3' to '&date4';
April 04, 2014, 05:26 PM
ChadSS
I was able to accomplish by doing the following:

DEFINE FILE XFILES
TODAY/I8YYMD = &YYMD;
DAY90/I8YYMD = AYMD(TODAY, 90, 'I8');
DAYS90/YYMD = DAY90;
AGEIN90/I5 = DATEDIF(BRTH_DT, DAYS90, 'Y');
AGE_FLAG/A1 = IF AGEIN90 EQ '65' AND AGE EQ '64' THEN 'Y' ELSE 'N';
END