Dear all,
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;
time os_m*censors(0);
strata treat;
title1 'Kaplan-Meier Plot for OS';
label os_m="Months";
where itt=1;
run;
ods rtf close;
Thank you,
MK
PS: These need to go in a power point slide deck.
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.
With SAS 9.40M3, GTL supports output with transparent background. You will also have to make the wall transparent.
See OPAQUE option in BEGINGRAPH.
I am using SAS 9.4. Do you have a sample code that outputs the KM graph with transparent background?
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;
run;
/*--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;
keylegend 's';
run;
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?
Many thanks,
Mira
I believe you (or your company) can upgrade to a new maintenance release.
Contact contracts@sas.com, or, call our customer service line 919-677-8003.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.