Example 22.3 Customizing Survival Plots

The LIFETEST procedure, like other statistical procedures, provides a PLOTS= option and other options for modifying its output without requiring template changes. See Chapter 52: The LIFETEST Procedure, for more information. Those options are sufficient for many purposes. This example shows ways that you can change the graph by changing the graph template when those options are not sufficient. The first part of this example shows how to find the name of the template, display the template by using PROC TEMPLATE and the SOURCE statement, and change the title. This approach is sufficient for simple changes.

As this example progresses, a more aggressive approach to template modification is introduced. The survival plot template in PROC LIFETEST is long, and it has distinct components for different scenarios (single stratum versus multiple strata). The same options are often repeated in multiple statements. The next part of the example rewrites the template using macros and macro variables so that it is more modular and easier to modify. The subsequent parts of this example modify the template in other ways by using the rewritten template as the starting point. If you need to change the survival plot template, you too might find it easier to use this rewritten template as a starting point instead of the template as it is displayed by using PROC TEMPLATE and the SOURCE statement.

This example consists of the following parts:

  • Modifying the plot title: This part identifies the template, displays it, explains its overall structure, and modifies the titles. See the section Modifying the Plot Title.

  • Modifying the axes: This part explains the options that control the X and Y axes, and shows how to modify the ticks and axis labels. See the section Modifying the Axes.

  • Creating a template that is easy to modify: This part shows how you can reorganize and modularize the entire template to make it easy to customize it in various ways. See the section Creating a Template That Is Easy to Modify.

  • Modifying the plot title in the revised template: This part shows how to change the title by using the revised template. See the section Modifying the Plot Title in the Revised Template.

  • Modifying the legend and inset table: This part removes the small inset table and moves the legend inside the graph. The censoring information above the X axis is moved outside the graph. See the section Modifying the Legend and Inset Table.

  • Modifying the layout and adding a new inset table: This part moves the event and total information out of the graph and the legend in. It also moves the small inset table. See the section Modifying the Layout and Adding a New Inset Table.

  • Changing line styles: This part shows how to modify a style template to change line colors and styles. See the section Changing Line Styles.

  • Changing fonts: This part shows how to change the graph template and the style template to change some of the fonts that are used in the graph. See the section Changing Fonts.

  • Changing how censored data are displayed: This part shows how to change or remove the plus marks that are used to display censored observations. See the section Changing How Censored Data Are Displayed.

  • Displaying survival summary statistics: This part adds to the graph a table with event, censoring and survival information. See the section Displaying Survival Summary Statistics.

This example uses the bone marrow transplant data set Sashelp.BMT, which is also used in Chapter 52: The LIFETEST Procedure.