Here's my code below. Whenever I run it, the duration variable counts 0 for every observation in my dataset. Not sure why it's not calculating the duration in months between a patient's initial diagnosis date and the date of their death. Can someone take a look at my code and tell me if they see something wrong?
DATA survival_analysis; SET pancreas_temp4; duration = INTCK("DTMONTH", initial_dx_date1, coalesce(date_of_death1, date_last_fu_or_d1)); put duration = ; IF vital_status1 = 0 or not missing(date_of_death1) then censored = 1; ELSE IF vital_status1 = 1 then censored = 0; LABEL duration = "Duration in Months"; RUN;
And here is a clip of the SAS log file:
537 DATA survival_analysis; SET pancreas_temp4;
539 duration = INTCK("DTMONTH", initial_dx_date1, coalesce(date_of_death1,
540 put duration = ;
542 IF vital_status1 = 0 or not missing(date_of_death1) then censored = 1;
543 ELSE IF vital_status1 = 1 then censored = 0;
545 LABEL duration = "Duration in Months";
See all those lovely zeros? Why?! I checked all my dates and they are all the same format MMDDYY10, so I am not sure what's wrong. Any help is appreciated.
Also, here is some sample data. 1 = alive, 0 = dead
Registration is open! SAS is returning to Vegas for an AI and analytics experience like no other! Whether you're an executive, manager, end user or SAS partner, SAS Innovate is designed for everyone on your team. Register for just $495 by 12/31/2023.
If you are interested in speaking, there is still time to submit a session idea. More details are posted on the website.
Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.
Find more tutorials on the SAS Users YouTube channel.