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.

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


Register now!

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 1 reply
  • 618 views
  • 0 likes
  • 2 in conversation