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 ¶meter EQ PFS %then "Progression Free Survival";
%if ¶meter EQ OS %then "Overall Survival";
;
title2 &title;
proc lifetest data=adtte(where=(&population and PARAM EQ "¶meter" %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!
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;
/* 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;
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;
/* 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;
Thank you @MichaelL_SAS , it worked!
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.