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-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!

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