Customizing the Kaplan-Meier Survival Plot

Changing the Second Title and Adding a Footnote

Begin by including the macros that you copied in the section The Modularized Templates.

The following steps add an ENTRYFOOTNOTE statement to the %StmtsBeginGraph macro and suppress the second title:

%ProvideSurvivalMacros

%let ntitles = 1;
%macro StmtsBeginGraph;
   entryfootnote halign=left "Acme Company, %sysfunc(date(),worddate.)" /
                 textattrs=GraphDataText;
%mend;

%CompileSurvivalTemplates

proc lifetest data=sashelp.BMT
              plots=survival(cb=hw test);
   time T * Status(0);
   strata Group;
run;

The results are displayed in FigureĀ 32.

Figure 32: Footnote but No Second Title

Footnote but No Second Title


By default, the value of the nTitles macro variable is 2, and all titles are displayed. Setting nTitles to 1 suppresses the second title. You can add titles or footnotes to the plot by adding them to the %StmtsBeginGraph macro. This example adds a footnote that consists of a company name followed by the current date, formatted by using the WORDDATE format. The GraphDataText style element is used; it has a smaller font than the default style element, GraphFootnoteText.

The following steps replace the second title rather than adding a footnote:

%ProvideSurvivalMacros

%let ntitles = 1;

%macro StmtsBeginGraph;
entrytitle "Acme Company, %sysfunc(date(),worddate.)" /textattrs=GraphValueText;
%mend;

%CompileSurvivalTemplates

proc lifetest data=sashelp.BMT
   plots=survival(cb=hw test);
   time T * Status(0);
   strata Group;
run;

The results are displayed in FigureĀ 33. You can find the original definition of the second title in the %CompileSurvivalTemplates macro in the section The Larger Macros.

Figure 33: Replacing the Second Title

Replacing the Second Title


Last updated: December 09, 2022