Customizing the Kaplan-Meier Survival Plot


The LIFETEST procedure is a nonparametric procedure for analyzing survival data. You can use PROC LIFETEST to compute the Kaplan-Meier curve (1958), which is a nonparametric maximum likelihood estimate of the survivor function. The Kaplan-Meier plot (also called the product-limit survival plot) is a popular tool in medical, pharmaceutical, and life sciences research. The Kaplan-Meier plot contains step functions that represent the Kaplan-Meier curves of different samples (strata). The Kaplan-Meier plot has many other features that you can add or change through procedure options, graph templates, and style templates. This chapter explores these features in detail but does not explain how to interpret the graphs or the underlying analysis. For more information about PROC LIFETEST and the Kaplan-Meier plot, see Chapter 58: The LIFETEST Procedure.

This chapter shows you how to modify the Kaplan-Meier plot through a series of examples. It discusses four types of examples: specifying procedure options, modifying graph templates by using macro variables, modifying graph templates by using macros, and changing styles. Most examples do not go into detail about the tools that underlie the template changes. Each example is designed to be small, simple, self-contained, and easy to copy and use "as is" or with minor modifications. Subsequent sections provide more details about the macro variables and macros that are used to modify the graph templates. You can use the simple examples to make a wide variety of changes without reading or understanding the detailed descriptions at the end of this chapter.

Statistical procedures produce tables by using the Output Delivery System (ODS) and produce graphs by using ODS Graphics. Procedures produce graphs as automatically as they produce tables, and graphs and tables are integrated in the ODS output. Graphs that are produced by ODS Graphics are controlled by options, the data object (the matrix of information that is graphed), a style template, and a graph template. A style template is a SAS program that controls the overall appearance of graphs, including colors, line and marker styles, sizes, fonts, and so on. A graph template is a SAS program, written in the Graph Template Language (GTL), that provides a detailed specification of the layout and contents of each graph. Each graph that is created when ODS Graphics is enabled is controlled by a graph template.[12]

If you want to modify a graph template, you usually use the TEMPLATE procedure to display the template of interest, and then you copy it into your editor, modify it, and submit it to SAS to compile. Then, when you run your procedure, it uses the new template. The PROC LIFETEST survival plot is the only plot in SAS for which you have another alternative available for template modification. SAS provides the survival plot templates in a series of macros and macro variables that are modular and easier to modify than the original templates. This chapter provides numerous examples of using these macros and macro variables.

The data that are used in this chapter come from 137 bone marrow transplant patients in a study by Klein and Moeschberger (1997) and are available in the BMT data set in the Sashelp library. At the time of transplant, each patient is classified in one of three risk categories: ALL (acute lymphoblastic leukemia), AML (acute myelocytic leukemia)–Low Risk, and AML–High Risk. The endpoint of interest is the disease-free survival time, which is the time in days until death, relapse, or the end of the study. The variable Group represents the patient’s risk category, the variable T represents the disease-free survival time, and the variable Status is the censoring indicator. A status of 1 indicates an event time, and a status of 0 indicates a censored time.

[12] ODS Graphics might or might not be enabled by default. ODS Graphics is usually enabled by default in the SAS windowing environment and disabled when you invoke SAS in other ways. However, these defaults can be changed in a number of ways. ODS Graphics is enabled in the first example in this chapter by the ODS GRAPHICS ON statement and remains enabled throughout the chapter.