The original code can be accessed from SAS: Analysis of Multivariate Failure Time Data
https://documentation.sas.com/doc/en/statug/15.2/statug_phreg_details45.htm#statug_phreg012597
proc phreg covs(aggregate); model (Tstart,Tstop)*Status(0)=Trt Age; baseline covariates=Pattern out=out2 cmf=_all_; id ID; run;
However, if I add eventcode=1, the code does not work.
proc phreg covs(aggregate); model (Tstart,Tstop)*Status(0)=Trt Age/ evencode=1; baseline covariates=Pattern out=out2 cmf=_all_; id ID; run;
Can anyone help me figure it out? Many thanks!
Doesn't work is awful vague.
Are there errors in the log?: Post the code and log in a code box opened with the "</>" to maintain formatting of error messages.
No output? Post any log in a code box.
Unexpected output? Provide input data in the form of data step code pasted into a code box, the actual results and the expected results. Instructions here: https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat... will show how to turn an existing SAS data set into data step code that can be pasted into a forum code box using the "</>" icon or attached as text to show exactly what you have and that we can test code against.
Assuming of course your submitted code was EVENTCODE=1 not the EVENCODE shown in your post.
Quite often the LOG does have related information that you should share.
data is
ID | TStart | TStop | Status | Trt | Age |
174054 | 0 | 293 | 0 | 1 | 38 |
204001 | 0 | 219 | 1 | 2 | 12 |
204001 | 219 | 373 | 2 | 2 | 12 |
204001 | 373 | 414 | 0 | 2 | 12 |
I am sorry for the typo, It should be eventcode=1.
Actually I got some warnings. It seems cmf cannot work with Fine and Gray competing risk analysis together? So how can I write the code to generate mcf and competing risk together?
1)
I think you need to change your data structure(a subject has only one obs/Time/Status) to use EVENTCODE=1.
You can " create a time-varying covariate using programming statements in proc phreg." other than this kind of data structure [TStart, TStop] .
And Here is an example:
(here 'in_hosp' is a time-varying covariate)
proc phreg covs(aggregate);
model Time*Status(0)=Trt Age in_hosp/ evencode=1;
if Time> 219 then in_hosp = 0;
else in_hosp = 1;
run;
2)
If you don't have time-varying covariates, that would be better to use this code:
(Make sure a subject has only an obs and a TIME value and a STATUS value)
proc phreg covs(aggregate);
model Time*Status(0)=Trt Age/ evencode=1;
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.