BookmarkSubscribeRSS Feed
lilies
Calcite | Level 5

I'm attempting to customize the CIF graph from the PROC LIFETEST statement e.g. changing the title of the graph, the thickness of the graph lines, whether the graph lines are dashed, etc. However, I'm unable to find an easy way to do so. Does anyone have any recommendations? I considered using the %CIF macro, but I also would like to display the Gray's test box on the graph, which I don't think I can do if I use the %CIF macro. 

 

This is the code I'm using to generate the CIF graph with competing risk:

proc lifetest data=WORK.IMPORT plots=cif(test);

      time Time*Status(2) / eventcode=1;

      strata Variable; 

run;

 

My question is similar to this one, which was not answered: 

https://communities.sas.com/t5/Statistical-Procedures/Proc-lifetest-for-competing-risk/m-p/689519#M3...

 

7 REPLIES 7
Ksharp
Super User
ods select none;
ods output cifPlot=cifPlot GrayTest=GrayTest;
proc lifetest data=sashelp.bmt plots=cif(test);
      time t*Status(0) / eventcode=1;
     strata Group; 
run;
ods select all;
data _null_;
 set GrayTest;
 call symputx('pvalue',put(ProbChiSq,pvalue. -l));
run;

title 'Whatever is Title';
proc sgplot data=cifPlot;
styleattrs DATALINEPATTERNS=(solid dash shortdash);
step x=Time y=CIF / group=Stratum lineattrs=( thickness=4) ;
yaxis values=(0 to 1 by 0.2);
inset "Gray Test p=&pvalue." /border;
run;

Ksharp_0-1666007379776.png

 

lilies
Calcite | Level 5

Thank you so much @Ksharp! Is there a way to put an at risk table at the bottom of the graph like in survival plots? 

Ksharp
Super User

OK. You want this ?

 

ods select none;
ods output cifPlot=cifPlot GrayTest=GrayTest ;
proc lifetest data=sashelp.bmt plots=cif(test );
      time t*Status(0) / eventcode=1;
     strata Group; 
run;

ods output SurvivalPlot=SurvivalPlot;
proc lifetest data=sashelp.bmt  plots=survival(atrisk=0 to 2500 by 500);
      time t*Status(0) ;
     strata Group; 
run;
ods select all;


data _null_;
 set GrayTest;
 call symputx('pvalue',put(ProbChiSq,pvalue. -l));
run;

data want;
 merge cifPlot SurvivalPlot(keep=StratumNum Time tAtRisk AtRisk where=(tAtRisk is not missing)) ;
 by StratumNum Time;
length new_Stratum $ 80;
retain new_Stratum;
if first.StratumNum then call missing(new_Stratum);
if not missing(Stratum) then  new_Stratum=Stratum;
run;

title 'Whatever is Title';
ods graphics /ATTRPRIORITY=none ;
proc sgplot data=want;
styleattrs DATALINEPATTERNS=(solid dash shortdash);
step x=Time y=CIF / group=new_Stratum lineattrs=( thickness=4) ;
xaxistable atrisk / x=tAtRisk class=new_Stratum colorgroup=new_Stratum valueattrs=(weight=bold);
yaxis values=(0 to 1 by 0.2);
inset "Gray Test p=&pvalue." /border;
run;

Ksharp_0-1666093126042.png

 

Gene24
Calcite | Level 5

In a related question, I'm having difficulty editing the x and y scale and the graph title for my kaplan meier curve. This is my code here - what am I missing? 

 

proc lifetest data=WORK.IMPORT2 atrisk plots=survival(cb=hw atrisk(outside(0.15))=0 to 1825 by 365);
time 'Time to RN'n*'Re_RN (1=RN)'n(0);
strata 'Re_ICPI_Status (2=daul; 1=single'n;
run;

title 'Kaplan meier';
proc sgplot data=WORK.IMPORT2 ;
xaxis values=(0 to 1825 by 365);
run;

Ksharp
Super User

I didn't get any problem yet !

 

ods select none;
ods output SurvivalPlot=SurvivalPlot;
proc lifetest data=sashelp.bmt  plots=survival(atrisk=0 to 2500 by 500);
      time t*Status(0) ;
     strata Group; 
run;
ods select all;

title 'Whatever is Title';
ods graphics /ATTRPRIORITY=none ;
proc sgplot data=SurvivalPlot;
styleattrs DATALINEPATTERNS=(solid dash shortdash);
step x=Time y=Survival / group=Stratum lineattrs=( thickness=4) ;
yaxis values=(0 to 1 by 0.1);
xaxis values=(0 to 2500 by 200);

run;

Ksharp_0-1667642735607.png

 

Gene24
Calcite | Level 5

Thank you!

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 2626 views
  • 0 likes
  • 3 in conversation