BookmarkSubscribeRSS Feed
MiraKr_
Obsidian | Level 7

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

 

7 REPLIES 7
MiraKr_
Obsidian | Level 7

PS: These need to go in a power point slide deck.

Reeza
Super User

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. 

 

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

Jay54
Meteorite | Level 14

With SAS 9.40M3, GTL supports output with transparent background.  You will also have to make the wall transparent.

See OPAQUE option in BEGINGRAPH.

MiraKr_
Obsidian | Level 7

I am using SAS 9.4. Do you have a sample code that outputs the KM graph with transparent background?

Jay54
Meteorite | Level 14

If you have SAS 9.40M3 (M3 is important), you can do one of the following:

 

Change the PROC Lifetest template.

  1. Find the name of the template using ODS TRACE on;
  2. Then update the template to make the background and wall transparent.
  3. Rerun your proc lifetest program.

 

Or, run the lifetest procedure and get the data saved to a sas data set using ODS OUTPUT.

  1. Run your own SGPLOT program to create the Survival plot using program below.
  2. Note the NOOPAQUE and NOWALL options on the SGPLOT procedure statement.

 

/*--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;

 

MiraKr_
Obsidian | Level 7

Thank you 

 

Jay54
Meteorite | Level 14

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.

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

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
  • 1529 views
  • 0 likes
  • 3 in conversation