DATA Step, Macro, Functions and more

Working with dates

Reply
Contributor
Posts: 27

Working with dates

Hi guys,

I was working with some clinical data where I need calculate the age from date of birth variables and current date variable.But the date of birth variable is divided into three different variables as day, month and year.How do i do this.
N/A
Posts: 0

Re: Working with dates

You can use MDY() function.
Contributor
Posts: 31

Re: Working with dates

suppose the 3 birth date vairables are brtyr (birth year) brtmon( birth month) and btrdat (bith date).
Then just do
birth_dt=mdy(brtmon,btrdat ,brtyr);
age=int((today()-birth_dt)/365.25);

hope that helps.
Contributor
Posts: 27

Re: Working with dates

Thanks guys!!
Ask a Question
Discussion stats
  • 3 replies
  • 126 views
  • 0 likes
  • 3 in conversation