I'm using this code to calculate age in months using two different methods:
x_age_mn_m1 = intck("month", dob, 1_date)+0.5;
x_age_mn_d1 = intck ("day", dob, 1_date)/30.43;
x_age_mn_m2 = intck("month", dob, 2_date)+0.5;
x_age_mn_d2 = intck ("day", dob, 2_date)/30.43;
The code works fine, but there are improbable values generated for the age_mn variables (x_age_mn_m1 and x_age_mn_d1) one of the inputs, only one!
Why does this happen, and how can I solve it? Thanks!
ID | DOB | 1_date | x_age_mn_m1 | x_age_mn_d1 | 2_date | x_age_mn_m2 | x_age_mn_d2 |
z | 05/23/2012 | 03/30/3017 | 12058.5 | 12060.93 | 05/15/2017 | 60.5 | 59.744 |
Did you intend for that date to be almost 1,000 years in the future?
03/30/3017
Jim
Did you intend for that date to be almost 1,000 years in the future?
03/30/3017
Jim
If you want to count calendar months rather than month boundaries then use this option:
x_age_mn_m1 = intck("month", dob, 1_date, 'C');
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Select SAS Training centers are offering in-person courses. View upcoming courses for: