BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
amng
Calcite | Level 5

Hi, I am working on a Cox Regression Model and am having trouble formatting my date to event. I have two variables showing the month of the event (DOD_M) and the year (DOD_Y). The month is formatted as a numeric variable (1-12), and the year is a numeric four digit variable (1995-2018). I would like to eventually create a variable that shows the time to event from enrollment in the study (5/1/1995) to the event, in months. What is the easiest way to do this? Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Reeza
Super User

use the MDY() 

 

start_date = mdy(month, 1, year);
duration = intck('month', start_date, event_date);

Look up INTCK() and in particular the fourth parameter.

View solution in original post

1 REPLY 1
Reeza
Super User

use the MDY() 

 

start_date = mdy(month, 1, year);
duration = intck('month', start_date, event_date);

Look up INTCK() and in particular the fourth parameter.