Written and maintained by CASRAI Editorial Board
Published
On this page
SAS PROC LIFETEST: Survival Analysis Guide
PROC LIFETEST is a SAS procedure used for non-parametric survival analysis. It is primarily used to analyze time-to-event data where the event of interest is not observed for all subjects (censored data). In research, this is critical for clinical trials, engineering reliability studies, and any field studying the duration until an occurrence. PROC LIFETEST computes nonparametric estimates of the survival function, most notably the Kaplan-Meier product-limit estimate.
What PROC LIFETEST is used for in research
In research, survival analysis is the primary method for analyzing the time until a specific event occurs. PROC LIFETEST is the go-to tool in the SAS ecosystem for this analysis because it requires no assumptions about the distribution of survival times. Researchers use it to:
- Estimate survival probabilities over time using the Kaplan-Meier method.
- Compare survival distributions between two or more groups (e.g., treatment vs. placebo) using rank tests like the Log-Rank test or Wilcoxon test.
- Calculate median survival times and other quartiles.
- Handle censored data, where the event of interest did not occur before the end of the study.
How to install or access PROC LIFETEST
PROC LIFETEST is a standard procedure included in the base SAS software installation. It does not require additional modules. You access it by running a SAS program in your SAS environment (e.g., SAS Studio, SAS Enterprise Guide). Ensure your SAS environment is licensed and configured according to official SAS documentation.
How to use PROC LIFETEST step by step
To perform a survival analysis, follow these steps:
- Prepare your data: Ensure your dataset has a variable for time-to-event (e.g., days from diagnosis to event) and a censoring indicator variable (e.g., 0 for censored, 1 for event).
- Syntax structure:
proc lifetest data=your_dataset plots=(survival); time event_time * censor_var(0); strata group_var; run; - Explanation:
DATA=: Specifies the input dataset.TIME: Defines the time variable and censoring variable. The value in parentheses,(0)in this example, indicates that 0 represents a censored observation.STRATA: Optional. Used to compare survival between groups.PLOTS=(SURVIVAL): Requests the Kaplan-Meier survival curve plot.
How to read the output
The output includes several critical tables:
- Product-Limit Survival Estimates: Shows the survival function estimate at each event time, the number of subjects at risk, and the number of events.
- Summary Statistics: Provides mean and median survival times, which are essential for comparing treatment efficacy.
- Rank Tests: Statistical significance of group differences. The Log-Rank test is most commonly used for comparing survival curves across strata.
Troubleshooting PROC LIFETEST
Common issues:
- Plots not appearing: Ensure
ods graphics on;is executed at the start of your SAS session. - Censoring error: Double-check that your censoring indicator is coded correctly according to your
TIMEstatement specifications. - Dataset not found: Verify your library reference (libref) is correct and the dataset is accessible.
Free alternatives to PROC LIFETEST
| Tool | Focus |
|---|---|
| R (survival package) | Comprehensive survival analysis, widely used in research. |
| Python (lifelines) | Survival analysis and reliability modeling, intuitive for Python users. |
Frequently asked questions
How do I know if my data is censored?
Data is censored if the event of interest (e.g., death, equipment failure) has not occurred for some subjects by the end of the study period, or if they were lost to follow-up.
Can I compare more than two groups?
Yes, the STRATA statement allows you to include multiple groups, and SAS will perform global tests for equality across all groups.
Sources
- SAS Documentation (Accessed: 2026-11-18)
- Clinical Biostatistics Resources (Accessed: 2026-11-18)







