Survival Analysis
using SAS
Advanced PROC LIFETEST
See
www.stattutorials.com/SASDATA
for files mentioned in this tutorial © TexaSoft, 2006
These SAS statistics tutorials briefly explain the use and
interpretation of standard statistical analysis techniques for Medical,
Pharmaceutical, Clinical Trials, Marketing or Scientific Research. The examples
include how-to instructions for SAS Software.
Survival Analysis Example Using LIFETEST
Survival data consist of a response (event time, failure time, or survival
time) variable that measures the duration of time until a specified event
occurs and possibly a set of independent variables thought to be associated
with the failure time variable. These independent variables (concomitant
variables, covariates, or prognostic factors) can be either discrete, such as
sex or race, or continuous, such as age or temperature. The system that gives
rise to the event of interest can be biological, as for most medical data, or
physical, as for engineering data. The purpose of survival analysis is to
model the underlying distribution of the failure time variable and to assess
the dependence of the failure time variable on the independent variables.
The following data is from Prentice, R.L. "Exponential survivals with
censoring and explanatory variables.", Biometrika 60, 1973, 279-288.
The LIFETEST procedure computes nonparametric estimates of the survival
distribution function. You can request either the product-limit (Kaplan and
Meier) or the life-table (actuarial) estimate of the distribution. PROC
LIFETEST computes nonparametric tests to compare the survival curves of two or
more groups.
The following statements are available in PROC
LIFETEST:
PROC
LIFETEST
< options > ;
TIME
variable < *censor(list) > ;
BY
variables ;
FREQ
variable ;
ID
variables ;
STRATA
variable < (list) > < ... variable < (list) > > ;
SURVIVAL
options ;
TEST
variables ;
Some of these options include:
METHOD=type
specifies the method
used to compute the survival function estimates. Valid values for type are as
follows.
PL | KM
specifies that
product-limit (PL) or Kaplan-Meier (KM) estimates are computed.
ACT | LIFE | LT
specifies that
life-table (or actuarial) estimates are computed.
By default, METHOD=PL.
PLOTS= ( type
<(NAME=name)> <, ..., type <(NAME=name)> > )
creates plots of
survival estimates or censored observations, where type is the type of plot
and name is a catalog entry name of up to eight characters. Valid values of
type are as follows:
CENSORED | C
specifies a plot of
censored observations by strata (product-limit method only).
SURVIVAL | S
specifies a plot of the
estimated SDF versus time.
LOGSURV | LS
specifies a plot of the
-log( estimated SDF) versus time.
LOGLOGS | LLS
specifies a plot of the
log(-log( estimated SDF)) versus log( time).
HAZARD | H
specifies a plot of the
estimated hazard function versus time (life-table method only).
PDF | P
specifies a plot of the
estimated probability density function versus time (life-table method only).
Parentheses are required in specifying the plots. For example,
plots = (s)
requests a plot of the
estimated survivor function versus time, and
plots = (s(name=Surv2),
h(name=Haz2))
requests a plot of the
estimated survivor function versus time and a plot of the estimated hazard
function versus time, with Surv2 and Haz2 as their catalog names,
respectively.
STRATA
Statement
STRATA variable < (list) > < ... variable
< (list) > > < /options >;
The STRATA statement indicates which variables determine strata levels
for the computations. The strata are formed according to the nonmissing values
of the designated strata variables. The MISSING option can be used to allow
missing values as a valid stratum level. Other options enable you to specify
various k-sample tests, trend tests and stratified tests. The specification of
STRATA variables can have any of the following forms:
|
list
separated by blanks |
strata age(5 10 20 30) |
|
list
separated by commas |
strata age(5,10,20,30) |
|
x to y |
strata age(5 to 10) |
|
x to y
by z |
strata age(5 to 30 by 10) |
|
combination of the above |
strata age(5,10 to 50 by 10) |
For example, the specification
strata age(5,20 to 50 by 10) sex;
indicates the
following levels for the Age variable

Following is a example analysis: (PROC-LIFE-1.SAS)
ODS
HTML;
ODS
GRAPHICS On;
proc
lifetest
data=mydata.Life
plots=(s);
time SURVIVAL * CENSOR (0);
title
'Survival Analysis -- One
group';
run
;
*..............................Including a grouping variable;
proc
lifetest
data=mydata.Life
plots=(s);
time SURVIVAL * CENSOR (0);
strata GROUP;
title 'Survival
Analysis -- Compare Groups';
run
;
ODS
HTML
CLOSE;
ODS
GRAPHICS OFF;
quit
;
Results in the following (partial) output. The
first table is the Product-Limit Survival Estimates
The LIFETEST Procedure
|
Product-Limit Survival Estimates |
|
SURVIVAL |
|
Survival |
Failure |
Survival Standard
Error |
Number
Failed |
Number
Left |
|
0.000 |
|
1.0000 |
0 |
0 |
0 |
62 |
|
1.000 |
|
. |
. |
. |
1 |
61 |
|
1.000 |
|
0.9677 |
0.0323 |
0.0224 |
2 |
60 |
|
3.000 |
|
0.9516 |
0.0484 |
0.0273 |
3 |
59 |
|
7.000 |
|
0.9355 |
0.0645 |
0.0312 |
4 |
58 |
|
8.000 |
|
. |
. |
. |
5 |
57 |
|
8.000 |
|
. |
. |
. |
6 |
56 |
|
8.000 |
|
0.8871 |
0.1129 |
0.0402 |
7 |
55 |
|
10.000 |
|
0.8710 |
0.1290 |
0.0426 |
8 |
54 |
|
SKIP… |
|
0.8548 |
0.1452 |
0.0447 |
9 |
53 |
|
389.000 |
|
0.1010 |
0.8990 |
0.0417 |
52 |
5 |
|
411.000 |
|
0.0808 |
0.9192 |
0.0379 |
53 |
4 |
|
467.000 |
|
0.0606 |
0.9394 |
0.0334 |
54 |
3 |
|
587.000 |
|
0.0404 |
0.9596 |
0.0277 |
55 |
2 |
|
991.000 |
|
0.0202 |
0.9798 |
0.0199 |
56 |
1 |
|
999.000 |
|
0 |
1.0000 |
0 |
57 |
0 |
Summary Statistics for Time Variable SURVIVAL
|
Quartile Estimates |
|
Percent |
Point
Estimate |
95% Confidence
Interval |
|
[Lower |
Upper) |
|
75 |
186.000 |
117.000 |
314.000 |
|
50 |
84.000 |
48.000 |
117.000 |
|
25 |
30.000 |
12.000 |
45.000 |
|
Mean |
Standard Error |
|
158.006 |
29.467 |
