# Date difference for partial dates

I am calculating age difference between birthdate & today's date. As in data, We have partial birthdate i.e. sometimes birthdates such as full date(2000-12-12), only year+month(2000-12) or only year(2000) is available.

How we can calculate age on available birthdate date part.

In SAS, we use below formula,
yrdif(date1, date2, "ACT/ACT")

I tried using R,
time_length(difftime(TODAYDT, BRTHDT), unit = "year"))
but for partial dates it doesn't work, Can you please let me know how I can address this?

Thank you,
Harshal

how do differences between partial dates and a full date get solved in your SAS code ; what assumption is being made about what the partial date represents ? If you can determine that, then you could instruct R to make similar assumptions.

In SAS, Actual part of dates been comparing. let's example of Today's date 06-09-2023 & birthdate is only 1987 then only year will consider while calculating AGE. In below formula,

yrdif(date1, date2, "ACT/ACT") , ACT/ACT argument taking actual portion from both dates.