BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
NewUsrStat
Lapis Lazuli | Level 10

Dear all, 

suppose to have two dates: 

Date of Birth: 01JUL1936

Date of Admission: 03MAR2016

The age at admission calculated as: (Date of Admission-Date of Birth)/365.25 = 79.67. 

 

 

Since I need an integer, should this age be rounded to 80 or not? If yes, how? 

 

Thank you in advance

 

1 ACCEPTED SOLUTION

Accepted Solutions
PaigeMiller
Diamond | Level 26

Should it be rounded? Well, that's up to you, it depends on how you intend to use the result.

 

How to round it?

 

age_rounded = round(yrdif(date_of_birth,date_of_admission,'AGE'));
--
Paige Miller

View solution in original post

3 REPLIES 3
PaigeMiller
Diamond | Level 26

Should it be rounded? Well, that's up to you, it depends on how you intend to use the result.

 

How to round it?

 

age_rounded = round(yrdif(date_of_birth,date_of_admission,'AGE'));
--
Paige Miller
Kurt_Bremser
Super User
Use the YRDIF function with its default basis of AGE.
Age is not rounded up for the uses I know. You may have different business rules, though, but only you can know them.
PaigeMiller
Diamond | Level 26

Good point, @Kurt_Bremser about not rounding up

To round down, you would use the FLOOR function in SAS

--
Paige Miller