BookmarkSubscribeRSS Feed
xlsemi135
Fluorite | Level 6

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.

 

10 REPLIES 10
DarthPathos
Lapis Lazuli | Level 10

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

Has my article or post helped? Please mark as Solution or Like the article!
DarthPathos
Lapis Lazuli | Level 10
Sorry - realised I misread eventcode as errorcode 😞

Having said that I can't seem to find anything about the event code option - I always use time*status(0), but I'm also not on expert and rely heavily on the SAS papers and the community 🙂

Please do post the reference you used as I'd like to read up on this option!

Chris
Has my article or post helped? Please mark as Solution or Like the article!
Reeza
Super User

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.

 

http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_phreg_syntax...

 

@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. 

Reeza
Super User

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

 

 

xlsemi135
Fluorite | Level 6

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.

DarthPathos
Lapis Lazuli | Level 10

@Reeza I'm constantly impressed by your breadth and depth of knowledge.  Always learning from you 🙂

 

hope all is well and chat soon

Chris

 

Has my article or post helped? Please mark as Solution or Like the article!
xlsemi135
Fluorite | Level 6
Thanks for your kindly and timely response, but @Reeza 's post is more close to what I am looking for. I'm looking within the contents of competing risk survival analyses. Thanks again for your kindness.
xlsemi135
Fluorite | Level 6
Thank you. Actually, I was not even able to reproduce the proc lifetest code in the document. I was able to use "eventcode=1" in the proc phreg procedure, but cannot get survival plot. I'll search lexjansen.com. Thank you for your help!
Reeza
Super User

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. 

 

 

xlsemi135
Fluorite | Level 6

That's OK. The time*status(0) is not for competing risk.

 

You can find this topic in the following page:

 

http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_lifetest_exa...

 

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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

What is ANOVA?

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.

Discussion stats
  • 10 replies
  • 3181 views
  • 6 likes
  • 3 in conversation