Published on :
Statistical CREATION_INTERNE

Example 5 for PROC LIFEREG

This code is also available in: Deutsch Español Français
Awaiting validation
The script begins by creating a dataset named 'Fan' using embedded data (datalines) for the 'Lifetime' and 'Censor' variables. The 'Lifetime' variable is then scaled by being divided by 1000. Subsequently, it uses PROC LIFEREG to fit a survival regression model to the 'Fan' dataset. The model specifies 'Lifetime' as the survival time variable and 'Censor' (where 1 indicates a censored observation) as the censoring status variable, using a Weibull distribution. Options are enabled to generate a probability plot ('probplot'), a table of plot points ('ppout'), simultaneous nonparametric intervals ('npintervals=simul') and an inset in the ODS graph ('inset').
Data Analysis

Type : CREATION_INTERNE


The 'Fan' dataset is created directly within the script using the DATALINES clause, providing values for 'Lifetime' and 'Censor'.

1 Code Block
DATA STEP Data
Explanation :
This DATA Step block creates the 'Fan' dataset by reading 'Lifetime' (survival time) and 'Censor' (censoring indicator) data directly from datalines. The 'Lifetime' variable is then divided by 1000 to scale it (for example, from milliseconds to seconds or similar units).
Copied!
1DATA Fan;
2 INPUT Lifetime Censor;
3 Lifetime = Lifetime / 1000;
4 DATALINES;
5 450 0 460 1 1150 0 1150 0 1560 1
61600 0 1660 1 1850 1 1850 1 1850 1
71850 1 1850 1 2030 1 2030 1 2030 1
82070 0 2070 0 2080 0 2200 1 3000 1
93000 1 3000 1 3000 1 3100 0 3200 1
103450 0 3750 1 3750 1 4150 1 4150 1
114150 1 4150 1 4300 1 4300 1 4300 1
124300 1 4600 0 4850 1 4850 1 4850 1
134850 1 5000 1 5000 1 5000 1 6100 1
146100 0 6100 1 6100 1 6300 1 6450 1
156450 1 6700 1 7450 1 7800 1 7800 1
168100 1 8100 1 8200 1 8500 1 8500 1
178500 1 8750 1 8750 0 8750 1 9400 1
189900 1 10100 1 10100 1 10100 1 11500 1
19;
20 
2 Code Block
PROC LIFEREG
Explanation :
This block uses PROC LIFEREG to fit a survival regression model to the 'Fan' dataset. 'Lifetime' is the survival time variable and 'Censor' (where a value of 1 indicates a censored observation) is the censoring status variable. The model is specified with a Weibull distribution ('d=Weibull'). The options 'probplot', 'ppout', 'npintervals=simul', and 'inset' are used to generate a probability plot of the data, a table of plot points, simultaneous nonparametric intervals, and an inset in the ODS (Output Delivery System) graph, respectively. The 'ods graphics on;' statement enables the creation of high-quality graphical output.
Copied!
1ods graphics on;
2PROC LIFEREG DATA=Fan;
3 model Lifetime*Censor( 1 ) = / d = Weibull;
4 probplot
5 ppout
6 npintervals=simul;
7 inset;
8RUN;
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 : S A S S A M P L E L I B R A R Y