I am trying to ouput a KM curve using proc lifetest, but with with transparent background. This way, I can overlay the image over another JPEG image and see if the curves overlap. At the moment, the JPEG image appears with white, non-transparent background. I wish to keep everything the same (curve colors, etc) except the the background.
ods rtf file="&outputloc\test.rtf";
proc lifetest data=test method=KM
plots=survival(atrisk=0 to 30 by 3) timelist=0 to 30 by 3;
title1 'Kaplan-Meier Plot for OS';
ods rtf close;
I'm assuming you're not using SAS 9.4 since you're not using ODS PPT?
Anyways, here's a starter on customizing survival plots. It's not as easy as you'd like, unfortunately.
If you have SAS 9.40M3 (M3 is important), you can do one of the following:
Change the PROC Lifetest template.
Or, run the lifetest procedure and get the data saved to a sas data set using ODS OUTPUT.
/*--Get survival plot data from LIFETEST procedure--*/
ods graphics on;
ods output Survivalplot=SurvivalPlotData;
proc lifetest data=sashelp.BMT plots=survival(atrisk=0 to 2500 by 500);
time T * Status(0);
strata Group / test=logrank adjust=sidak;
/*--Survival Plot with outer Risk Table using AxisTable Transparent--*/
ods html close;
ods graphics / reset imagename='Survival Plot_SG_V94_Trans';
title 'Product-Limit Survival Estimates';
title2 h=0.8 'With Number of AML Subjects at Risk';
proc sgplot data=SurvivalPlotData noopaque nowall;
step x=time y=survival / group=stratum lineattrs=(pattern=solid) name='s';
scatter x=time y=censored / markerattrs=(symbol=plus) name='c';
scatter x=time y=censored / markerattrs=(symbol=plus) GROUP=stratum;
xaxistable atrisk / x=tatrisk location=outside class=stratum colorgroup=stratum;
keylegend 'c' / location=inside position=topright;
Thank you Sanjay_SAS! I tried running this code, but I guess I do not have M3 because I got an error message that the "noopaque" option is unrecognized. Is M3 something that can be dowloaded or do I have to purchase it separately?
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 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.