Published on :
Statistical CREATION_INTERNE

Natural Recovery Time - PROC LIFEREG Example

This code is also available in: Español Français
Awaiting validation
This script illustrates the use of the LIFEREG procedure to analyze survival data with arbitrary (interval) censoring. It models the relationship between recovery time, age, and sex, including an interaction. Two analyses are performed to generate probability plots (probplots) based on specific reference data (xrow1 and xrow2).
Data Analysis

Type : CREATION_INTERNE


All data (tables 'mice', 'xrow1', 'xrow2') are defined directly in the script via DATALINES blocks.

1 Code Block
DATA STEP Data
Explanation :
Creation of the main 'mice' dataset containing the explanatory variables (sex, age) and the time interval bounds (time1, time2).
Copied!
1title 'Natural Recovery Time';
2DATA mice;
3 INPUT sex age time1 time2;
4 DATALINES;
51 57 631 631
61 45 . 170
71 54 227 227
81 43 143 143
91 64 916 .
101 67 691 705
111 44 100 100
121 59 730 .
131 47 365 365
141 74 1916 1916
152 79 1326 .
162 75 837 837
172 84 1200 1235
182 54 . 365
192 74 1255 1255
202 71 1823 .
212 65 537 637
222 33 583 683
232 77 955 .
242 46 577 577
25;
2 Code Block
DATA STEP Data
Explanation :
Creation of a reference dataset 'xrow1' for prediction or plotting (Sex 1, Age 50).
Copied!
1DATA xrow1;
2 INPUT sex age time1 time2;
3 DATALINES;
41 50 . .
5;
3 Code Block
DATA STEP Data
Explanation :
Creation of a second reference dataset 'xrow2' (Sex 2, Age 60.6).
Copied!
1DATA xrow2;
2 INPUT sex age time1 time2;
3 DATALINES;
42 60.6 . .
5;
4 Code Block
PROC LIFEREG
Explanation :
Execution of the Weibull survival model with 'mice' data. The 'xdata=xrow1' option is used to customize the probability plot. The 'model' statement defines the censoring bounds (time1, time2) and the covariates.
Copied!
1ods graphics on;
2PROC LIFEREG DATA=mice xdata=xrow1;
3 class sex;
4 model (time1, time2) = age sex age*sex / dist=Weibull;
5 
6 probplot / nodata
7 plower=.5
8 vref(intersect) = 75
9 vreflab = '75 Percent';
10 inset;
11RUN;
5 Code Block
PROC LIFEREG
Explanation :
Second execution of the model, identical to the first, but using 'xrow2' as reference data for the plot.
Copied!
1PROC LIFEREG DATA=mice xdata=xrow2;
2 class sex;
3 model (time1, time2) = age sex age*sex / dist=Weibull;
4 
5 probplot / nodata
6 plower=.5
7 vref(intersect) = 75
8 vreflab = '75 Percent';
9 inset;
10RUN;
11title;
This material is provided "as is" by We Are Cas. There are no warranties, expressed or implied, as to merchantability or fitness for a particular purpose regarding the materials or code contained herein. We Are Cas is not responsible for errors in this material as it now exists or will exist, nor does We Are Cas provide technical support for it.
Copyright Info : SAS SAMPLE LIBRARY - NAME: LIFEREX4