Focal Point
[SOLVED] Calculating Age

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

March 20, 2017, 05:29 PM
Terri1977
[SOLVED] Calculating Age
I am attempting to calculate a person's age.

Here is what I have so far. When it prints the age field, for all the records, the age is 0. Please assist.

BIRTH_DT/YYMD = HDATE(BIRTH_DATE, 'YYMD');
BEGIN_DATE/YYMD = '&BEGDATE';
AGE_IN_DAYS/I5 = BEGIN_DATE - BIRTH_DATE;
AGE/I2 = AGE_IN_DAYS/365.25;

This message has been edited. Last edited by: FP Mod Chuck,


WebFOCUS 8
Windows, All Outputs
March 20, 2017, 05:30 PM
Doug
That's the same as your Calculate Birth Date post. The DATEADD is very powerful.




   In FOCUS Since 1983 ~ from FOCUS to WebFOCUS.
   Current: WebFOCUS Administrator at FIS Worldpay | 8204, 8206
March 21, 2017, 12:15 PM
jgelona
Why aren't you using DATEDIF?

AGE/I2=DATEDIF(BIRTH_DT,BEGIN_DT,'Y');

What you are doing can actually give a bad result because of leap days. I had this argument with the Feds several years ago and of course I won.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.