Computing age in SAS 9.3

This post was kindly contributed by The SAS Dummy - go there to comment and to read the full post.

It seems like such a simple problem: how can you reliably compute the age of someone or something? Susan lamented the subtle issues using the YRDIF function exactly 1.0356164384 years ago.

Sure, you could write your own function for calculating such things, as I suggested 0.1753424658 years ago.

Or you could ask your colleagues in the discussion forums, as I noticed some people doing just about 3.7890410959 years ago.

Or, now that SAS 9.3 is available, you can take advantage of the new AGE basis that the YRDIF function supports. For example:

data _null_;
  x = yrdif(’29JUN2010′d,today(),‘AGE’);
  y = yrdif(’09MAY2011′d,today(),‘AGE’);
  z = yrdif(’27SEP2007′d,today(),‘AGE’);
  put x= y= z=;
run;
 

Yields:

x=1.0356164384 y=0.1753424658 z=3.7890410959
 

This new feature and many more were added in direct response to customer feedback from Susan and others. And that’s a practice that never gets old.

This post was kindly contributed by The SAS Dummy - go there to comment and to read the full post.