BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
js5
Pyrite | Level 9 js5
Pyrite | Level 9

Dear community,

 

I need to generate powerpoint slides with Kaplan-Meier plots in them, no tables. I have achieved this with the following code:

%macro draw_kaplan_meier(population=, parameter=, title=, strata=, condition=);

	title %if &parameter EQ PFS %then "Progression Free Survival";
		%if &parameter EQ OS %then "Overall Survival";
		;
	title2 &title;

	proc lifetest data=adtte(where=(&population and PARAM EQ "&parameter" %if %length(&condition) GT 0 %then and &condition;)) plots=survival(atrisk(maxlen=20)) notable;
		time DAY * CENSORED(1);
		strata &strata %if %sysfunc(countw(&strata)) GT 1 %then /nolabel;;
	quit;

%mend draw_kaplan_meier;


proc template;
	define style styles.pptlsmallfont;
		parent=styles.powerpointlight;
		scheme "PPT Light Small Font" /
			body_font = ("Calibri, <MTsans-serif>, <sans-serif>", 14pt)
			heading_font = ("Calibri, <MTsans-serif>, <sans-serif>", 36pt);
	end;
run;

ods graphics on;
ods escapechar="~";
ods noproctitle;
ods powerpoint image_dpi=450 style=pptlsmallfont
	file="&output_path\kaplan_meier.pptx";
ods exclude CensoredSummary (persist) HomStats (persist) LogrankHomCov (persist) WilcoxonHomCov (persist) HomTests (persist) Legend (persist);

%draw_kaplan_meier(population=SAFFL EQ "Y", parameter=PFS, title=%str(Safety population), strata=SUBGR_A)
%draw_kaplan_meier(population=SAFFL EQ "Y", parameter=OS, title=%str(Safety population), strata=SUBGR_B)

title;
title2;
ods powerpoint close;

Unfortunately, despite all the exclusions, I can't get rid of the Testing Homogeneity of Survival Curves for DAY over Strata title, which causes the desired KM plot to scale down unnecessarily. Do you know if there is a way to suppress this title? Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
MichaelL_SAS
SAS Employee

It looks like the text you want to suppress is a note in ODS not a title. I believe either adding the name of that note (HomogeneityNote) to the exclude list or switching from excluding output to selecting the output you want to keep should work. 

 

I used this little toy example based on the code you provided and Example 74.2  in the PROC LIFETEST documentation to find the name of the note and test excluding it. 

 

 

/* Store ODS objects in test document */
ods document name=test(write); ods exclude CensoredSummary HomStats LogrankHomCov WilcoxonHomCov HomTests Legend ; proc lifetest data=sashelp.BMT plots=survival(atrisk=0 to 2500 by 500) notable; time T * Status(0); strata Group / test=logrank adjust=sidak; run; ods document close;
/* List objects in test document */ proc document name=test; list /levels=all; quit;

procDocOut.png

 

 

 

/*  Add note to exclude list */
ods exclude CensoredSummary  HomStats LogrankHomCov WilcoxonHomCov  HomTests Legend HomogeneityNote;
proc lifetest data=sashelp.BMT plots=survival(atrisk=0 to 2500 by 500) notable;
   time T * Status(0);
   strata Group / test=logrank adjust=sidak;
run;


/* Select only Homogeneity Tests and Survival Curves */
ods select  SurvDiff SurvivalPlot;
proc lifetest data=sashelp.BMT plots=survival(atrisk=0 to 2500 by 500) notable;
   time T * Status(0);
   strata Group / test=logrank adjust=sidak;
run;

 

 

View solution in original post

2 REPLIES 2
MichaelL_SAS
SAS Employee

It looks like the text you want to suppress is a note in ODS not a title. I believe either adding the name of that note (HomogeneityNote) to the exclude list or switching from excluding output to selecting the output you want to keep should work. 

 

I used this little toy example based on the code you provided and Example 74.2  in the PROC LIFETEST documentation to find the name of the note and test excluding it. 

 

 

/* Store ODS objects in test document */
ods document name=test(write); ods exclude CensoredSummary HomStats LogrankHomCov WilcoxonHomCov HomTests Legend ; proc lifetest data=sashelp.BMT plots=survival(atrisk=0 to 2500 by 500) notable; time T * Status(0); strata Group / test=logrank adjust=sidak; run; ods document close;
/* List objects in test document */ proc document name=test; list /levels=all; quit;

procDocOut.png

 

 

 

/*  Add note to exclude list */
ods exclude CensoredSummary  HomStats LogrankHomCov WilcoxonHomCov  HomTests Legend HomogeneityNote;
proc lifetest data=sashelp.BMT plots=survival(atrisk=0 to 2500 by 500) notable;
   time T * Status(0);
   strata Group / test=logrank adjust=sidak;
run;


/* Select only Homogeneity Tests and Survival Curves */
ods select  SurvDiff SurvivalPlot;
proc lifetest data=sashelp.BMT plots=survival(atrisk=0 to 2500 by 500) notable;
   time T * Status(0);
   strata Group / test=logrank adjust=sidak;
run;

 

 

Catch up on SAS Innovate 2026

Nearly 200 sessions are now available on demand with the SAS Innovate Digital Pass.

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

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 2 replies
  • 3896 views
  • 1 like
  • 2 in conversation