03-15-2012 03:22 AM
actually i am having a joining date i want to find how many years he was wroking to till date
Tot=yrdif(sdate, edate, 'ACT/365');
But i wnat the output like this how many years,months and days to till date.
sdate Years Months days
12jan2010 2 2 3
03-15-2012 07:50 AM
Here is a link to a useful article on the SAS website on how to calculate age from date of birth.
I've used this technique to answer your question, first of all I've calculated the total number of complete months between the 2 dates and then used this to get the values you need (years is the integer part of total_months/12, months is the remainder of total_months/12, days is the difference between the end date and the start date advanced by total_months.
format sdate enddate date9.;