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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 373 views
  • 0 likes
  • 2 in conversation