The LIFETEST Procedure

Getting Started: LIFETEST Procedure

(View the complete code for this example.)

You can use the LIFETEST procedure to compute nonparametric estimates of the survivor functions, to compare survival curves, and to compute rank tests for association of the failure time variable with covariates.

For simple analyses, only the PROC LIFETEST and TIME statements are required. Consider a sample of survival data. Suppose that the time variable is T and the censoring variable is C with value 1 indicating censored observations. The following statements compute the product-limit estimate for the sample:

proc lifetest;
   time t*c(1);
run;

You can use the STRATA statement to divide the data into various strata. A separate survivor function is then estimated for each stratum, and tests of the homogeneity of strata are performed. However, if the GROUP= option is also specified in the STRATA statement, the GROUP= variable is used to identify the samples whose survivor functions are to be compared, and the STRATA variables are used to define the strata for the stratified tests. You can specify covariates (prognostic variables) in the TEST statement, and PROC LIFETEST computes linear rank statistics to test the effects of these covariates on survival.

For example, consider the results of a small randomized trial on rats. Suppose you randomize 40 rats that have been exposed to a carcinogen into two treatment groups (Drug X and Placebo). The event of interest is death from cancer induced by the carcinogen. The response is the time from randomization to death. Four rats died of other causes; their survival times are regarded as censored observations. Interest lies in whether the survival distributions differ between the two treatments.

The following DATA step creates the data set Exposed, which contains four variables: Days (survival time in days from treatment to death), Status (censoring indicator variable: 0 if censored and 1 if not censored), Treatment (treatment indicator), and Sex (gender: F if female and M if male).

proc format;
   value Rx 1='Drug X' 0='Placebo';
run;
data exposed;
   input Days  Status Treatment Sex $ @@;
   format Treatment Rx.;
   datalines;
179   1   1   F   378   0   1   M
256   1   1   F   355   1   1   M
262   1   1   M   319   1   1   M
256   1   1   F   256   1   1   M
255   1   1   M   171   1   1   F
224   0   1   F   325   1   1   M
225   1   1   F   325   1   1   M
287   1   1   M   217   1   1   F
319   1   1   M   255   1   1   F
264   1   1   M   256   1   1   F
237   0   0   F   291   1   0   M
156   1   0   F   323   1   0   M
270   1   0   M   253   1   0   M
257   1   0   M   206   1   0   F
242   1   0   M   206   1   0   F
157   1   0   F   237   1   0   M
249   1   0   M   211   1   0   F
180   1   0   F   229   1   0   F
226   1   0   F   234   1   0   F
268   0   0   M   209   1   0   F
;

PROC LIFETEST is invoked as follows to compute the product-limit estimate of the survivor function for each treatment and to compare the survivor functions between the two treatments:

ods graphics on;
proc lifetest data=Exposed plots=(survival(atrisk) logsurv);
   time Days*Status(0);
   strata Treatment;
run;
ods graphics off;

In the TIME statement, the survival time variable, Days, is crossed with the censoring variable, Status, with the value 0 indicating censoring. That is, the values of Days are considered censored if the corresponding values of Status are 0; otherwise, they are considered as event times. In the STRATA statement, the variable Treatment is specified, which indicates that the data are to be divided into strata based on the values of Treatment. ODS Graphics must be enabled before producing graphs. Two plots are requested through the PLOTS= option—a plot of the survival curves with at risk numbers and a plot of the negative log of the survival curves.

The results of the analysis are displayed in the following figures.

Figure 72.1 displays the product-limit survival estimate for the Drug X group (Treatment=1). The figure lists, for each observed time, the survival estimate, failure rate, standard error of the estimate, cumulative number of failures, and number of subjects remaining in the study.

Figure 72.1: Survivor Function Estimate for the Drug X-Treated Rats

The LIFETEST Procedure
 
Stratum 1: Treatment = Drug X

Product-Limit Survival Estimates
Days SurvivalFailureSurvival Standard
Error
Number
Failed
Number
Left
0.000 1.000000020
171.000 0.95000.05000.0487119
179.000 0.90000.10000.0671218
217.000 0.85000.15000.0798317
224.000*...316
225.000 0.79690.20310.0908415
255.000 ...514
255.000 0.69060.30940.1053613
256.000 ...712
256.000 ...811
256.000 ...910
256.000 0.47810.52190.1146109
262.000 0.42500.57500.1135118
264.000 0.37190.62810.1111127
287.000 0.31870.68130.1071136
319.000 ...145
319.000 0.21250.78750.0942154
325.000 ...163
325.000 0.10620.89380.0710172
355.000 0.05310.94690.0517181
378.000*...180

Note:The marked survival times are censored observations.



Figure 72.2 displays summary statistics of survival times for the Drug X group. It contains estimates of the 25th, 50th, and 75th percentiles and the corresponding 95% confidence limits. The median survival time for rats in this treatment is 256 days. The mean and standard error are also displayed; however, these values are underestimated because the largest observed time is censored and the estimation is restricted to the largest event time.

Figure 72.2: Summary Statistics of Survival Times for Drug X-Treated Rats

Quartile Estimates
PercentPoint
Estimate
95% Confidence Interval
Transform[LowerUpper)
75319.000LOGLOG256.000355.000
50256.000LOGLOG255.000319.000
25255.000LOGLOG171.000256.000

MeanStandard
Error
271.13111.877

Note:The mean survival time and its standard error were underestimated because the largest observation was censored and the estimation was restricted to the largest event time.



Figure 72.3 and Figure 72.4 display the survival estimates and the summary statistics of the survival times for Placebo (Treatment=0). The median survival time for rats in this treatment is 235 days.

Figure 72.3: Survivor Function Estimate for Placebo-Treated Rats

The LIFETEST Procedure
 
Stratum 2: Treatment = Placebo

Product-Limit Survival Estimates
Days SurvivalFailureSurvival Standard
Error
Number
Failed
Number
Left
0.000 1.000000020
156.000 0.95000.05000.0487119
157.000 0.90000.10000.0671218
180.000 0.85000.15000.0798317
206.000 ...416
206.000 0.75000.25000.0968515
209.000 0.70000.30000.1025614
211.000 0.65000.35000.1067713
226.000 0.60000.40000.1095812
229.000 0.55000.45000.1112911
234.000 0.50000.50000.11181010
237.000 0.45000.55000.1112119
237.000*...118
242.000 0.39380.60630.1106127
249.000 0.33750.66250.1082136
253.000 0.28130.71880.1038145
257.000 0.22500.77500.0971154
268.000*...153
270.000 0.15000.85000.0891162
291.000 0.07500.92500.0693171
323.000 01.0000.180

Note:The marked survival times are censored observations.



Figure 72.4: Summary Statistics of Survival Times for Placebo-Treated Rats

Quartile Estimates
PercentPoint
Estimate
95% Confidence Interval
Transform[LowerUpper)
75257.000LOGLOG237.000323.000
50235.500LOGLOG206.000253.000
25207.500LOGLOG156.000229.000

MeanStandard
Error
235.15610.211


A summary of the number of censored and event observations is shown in Figure 72.5. The figure lists, for each stratum, the number of event and censored observations, and the percentage of censored observations.

Figure 72.5: Number of Event and Censored Observations

Summary of the Number of Censored and Uncensored Values
StratumTreatmentTotalFailedCensored Percent
Censored
1Drug X2018210.00
2Placebo2018210.00
Total 4036410.00


Figure 72.6 displays the graph of the product-limit survivor function estimates versus survival time. The two treatments differ primarily at larger survival times. Note the number of subjects at risk in the plot. You can display the number of subjects at risk at specific time points by using the ATRISK= option.

Figure 72.6: Plot of Estimated Survivor Functions

Plot of Estimated Survivor Functions


Figure 72.7 displays the graph of the log survivor function estimates versus survival time. Neither curve approximates a straight line through the origin—the exponential model is not appropriate for the survival data.

Note that these graphical displays are generated through ODS. For general information about ODS Graphics, see Chapter 21: Statistical Graphics Using ODS.

Figure 72.7: Plot of Estimated Negative Log Survivor Functions

Plot of Estimated Negative Log Survivor Functions


Results of the comparison of survival curves between the two treatments are shown in Figure 72.8. The rank tests for homogeneity indicate a significant difference between the treatments (p = 0.0175 for the log-rank test and p = 0.0249 for the Wilcoxon test). Rats treated with Drug X live significantly longer than those treated with Placebo. Since the survival curves for the two treatments differ primarily at longer survival times, the Wilcoxon test, which places more weight on shorter survival times, becomes less significant than the log-rank test. As noted earlier, the exponential model is not appropriate for the given survival data; consequently, the result of the likelihood ratio test should be ignored.

Figure 72.8: Results of the Two-Sample Tests

Test of Equality over Strata
TestChi-SquareDFPr >
Chi-Square
Log-Rank5.648510.0175
Wilcoxon5.031210.0249
-2Log(LR)0.198310.6561


Next, suppose male rats and female rats are thought to have different survival rates, and you want to assess the treatment effect while adjusting for the gender differences. By specifying the variable Sex in the STRATA statement as a stratifying variable and by specifying the variable Treatment in the GROUP= option, you can carry out a stratified test to test Treatment while adjusting for Sex. The test statistics are computed by pooling over the strata defined by the values of Sex, thus controlling for the effect of Sex. The NOTABLE option is added to the PROC LIFETEST statement as follows to avoid estimating a survival curve for each gender:

proc lifetest data=Exposed notable;
   time Days*Status(0);
   strata Sex / group=Treatment;
run;

Results of the stratified tests are shown in Figure 72.9. The treatment effect is statistically significant for both the log-rank test (p = 0.0071) and the Wilcoxon test (p = 0.0150). As compared to the results of the unstratified tests in Figure 72.8, the significance of the treatment effect has been sharpened by controlling for the effect of the gender of the subjects.

Figure 72.9: Results of the Stratified Two-Sample Tests

The LIFETEST Procedure

Stratified Test of Equality over Group
TestChi-SquareDFPr >
Chi-Square
Log-Rank7.246610.0071
Wilcoxon5.917910.0150


Since Treatment is a binary variable, another way to study the effect of Treatment is to carry out a censored linear rank test with Treatment as an independent variable. This test is less popular than the two-sample test; nevertheless, in situations where the independent variables are continuous and are difficult to discretize, it might be infeasible to perform a k-sample test. To compute the censored linear rank statistics to test the Treatment effect, Treatment is specified in the TEST statement as follows:

proc lifetest data=Exposed notable;
   time Days*Status(0);
   test Treatment;
run;

Results of the linear rank tests are shown Figure 72.10. The p-values are very similar to those of the two-sample tests in Figure 72.8.

Figure 72.10: Results of Linear Rank Tests of Treatment

The LIFETEST Procedure

Univariate Chi-Squares for the Wilcoxon Test
Variable Test
Statistic
Standard
Error
Chi-SquarePr >
Chi-Square
Treatment3.95251.75245.08750.0241

Univariate Chi-Squares for the Log-Rank Test
Variable Test
Statistic
Standard
Error
Chi-SquarePr >
Chi-Square
Treatment6.27082.67935.47790.0193


With Sex as a prognostic factor that you want to control, you can compute a stratified linear rank statistic to test the effect of Treatment by specifying Sex in the STRATA statement and Treatment in the TEST statement as in the following program. The TEST=NONE option is specified in the STRATA statement to suppress the two-sample tests for Sex.

proc lifetest data=Exposed notable;
   time Days*Status(0);
   strata Sex / test=none;
   test Treatment;
run;

Results of the stratified linear rank tests are shown in Figure 72.11. The p-values are very similar to those of the stratified tests in Figure 72.9.

Figure 72.11: Results of Stratified Linear Rank Tests of Treatment

The LIFETEST Procedure

Univariate Chi-Squares for the Wilcoxon Test
Variable Test
Statistic
Standard
Error
Chi-SquarePr >
Chi-Square
Treatment4.23721.73715.95030.0147

Univariate Chi-Squares for the Log-Rank Test
Variable Test
Statistic
Standard
Error
Chi-SquarePr >
Chi-Square
Treatment6.80212.54197.16090.0075


Last updated: February 13, 2019