Hello,
I want to plot a survival curve for competing risk but I cannot find out how it is implememted in SAS. I want survival curve S(t), not the cumullative infidence function. If anyone happen to know how to implement this, please let me know. Thank you very much!
Here is what I have tried:
(1) I tried "proc phreg"
data Risk;
group=0; output;
group=1; output;
run;
proc phreg data=mm(where=(time_to_event_year < 30)) plots(overlay=stratum)=survival;
class group(order=internal);* ref=first);
model time_to_event_year*death_status(0)=group / eventcode=1;
Hazardratio 'Pairwise' group / diff=pairwise;
baseline covariates=Risk out=out1 cif=_all_ / seed=191;
run;
I got an error message:
ERROR: Cannot request a SURVIVAL plot for the Fine and Gray competing-risks analysis.
(2) I also tried "proc lifetest"
proc lifetest data=mm(where=(time_to_event_year < 30)) plots=survival;
class group;
time time_to_event_year*death_status(0) / eventcode=1;
strata group / order=internal;
run;
Again, I got error message that "/ eventcode = 1" cannot be recoganized and ignored. However, when I checked the lifetest procedure, this is an option.
It would be great if anyone can help! Thanks again.
Hi and welcome to the community!
In checking the SAS Stat User's Guide (Version 14.1), there isn't an / errorcode= option. The closest I see is error= but the only options are AALEN and DELTA.
If you have access to SAS ODS, I recommend using the SAS ODS Graphics Designer (See Example 6) as it assists you in building your graph and you can the save the code and modify it in your SAS Editor.
If you can provide the link to the documentation you were using, it would help (possibly an option that has since been deprecated?).
Good luck and post back what you find out!
Chris
Eventcode = has a small section in the doc
EVENTCODE=number
FAILCODE=number
specifies the number that represents the event of interest for the competing-risks analysis of Fine and Gray (1999). For example:
model T*Status(0 1)= X1-X5 / eventcode=2;
This specifies that a subject whose Status value is 2 has the event of interest, a subject whose Status value is 0 or 1 is a censored observation, and a subject that has another value of the Status variable has a competing event.
@xlsemi135 If you don't get an answer soon, I would recommend searching lexjansen.com. I suspect this is a common request and it would have the code on how to achieve this.
FYI - I suspect there's a methodological reason for not generating a survival curve, but using a CiF instead.
Unfortunately it's been 5 years since I last did survival analysis.
http://www.mwsug.org/proceedings/2016/RF/MWSUG-2016-RF01.pdf
When I googled competing risk survival analyses, CIF plots are generated and the surival plots are not mentioned. It would be great to know why survival function is not used for competing risk? It appears that the competing event can be adjusted by excluding them from the denominator?
If it would be greate if you can find the reference you are referrring to. Thanks.
@Reeza I'm constantly impressed by your breadth and depth of knowledge. Always learning from you 🙂
hope all is well and chat soon
Chris
Survival plots are biased when you have competing risks, the CIF is used instead.
If you want survival plots regardless you may need to recode your data. Proc lifetest is non parametric and does not deal with competing risks AFAIK.
That's OK. The time*status(0) is not for competing risk.
You can find this topic in the following page:
They used the following code in lifetest:
proc lifetest data=bmt plots=cif(test ); time Dftime*Status(0)/eventcode=1; strata Gender/group=Disease order=internal; format Disease diseaseLabel. Gender genderLabel.; run;
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
ANOVA, or Analysis Of Variance, is used to compare the averages or means of two or more populations to better understand how they differ. Watch this tutorial for more.
Find more tutorials on the SAS Users YouTube channel.