Here is a simple, complete program (except for retrieving the %ProvideSurvivalMacros macro from the sample library) with setup, macro variable modifications to change the title, and cleanup:
/*-- Original Macro Variable Definitions ---------------------------------- %let TitleText0 = METHOD " Survival Estimate"; %let TitleText1 = &titletext0 " for " STRATUMID; %let TitleText2 = &titletext0 "s"; -------------------------------------------------------------------------*/ /* Make the macros and macro */ %ProvideSurvivalMacros /* variables available. */ %let TitleText0 = "Kaplan-Meier Plot"; /* Change the title. */ %let TitleText1 = &titletext0 " for " STRATUMID; %let TitleText2 = &titletext0; %CompileSurvivalTemplates /* Compile the templates with */ /* the new title. */ proc lifetest data=sashelp.BMT /* Perform the analysis and make */ plots=survival(cb=hw test); /* the graph. */ time T * Status(0); strata Group; run; %ProvideSurvivalMacros /* Optionally restore the default */ /* macros and macro variables. */ proc template; /* Delete the modified templates. */ delete Stat.Lifetest.Graphics.ProductLimitSurvival / store=sasuser.templat; delete Stat.Lifetest.Graphics.ProductLimitSurvival2 / store=sasuser.templat; run;
The results are displayed in Figure 23.17. You can see that the graph title is now 'Kaplan-Meier Plot'.
There are multiple title macro variables because two different types of plots are defined in the survival plot templates.
The first macro variable, TitleText0
, contains the text that is the same for both types of plots. The second macro variable, TitleText1
, contains the title for the single-stratum case. The third macro variable, TitleText2
, contains the title for the multiple-strata case. Both TitleText1
and TitleText2
use the common text defined in TitleText0
. Both TitleText0
and TitleText2
were changed from their original definition; the definition of TitleText1
was copied from the %ProvideSurvivalMacros macro. You must provide all relevant %LET statements when you modify TitleText0
. In this case it is TitleText0
and TitleText2
, but it is easy to copy all three and then just modify what you need. Alternatively, when you know the number of strata,
you can modify only TitleText1
or TitleText2
.