Published on :
Statistical CREATION_INTERNE

Example 6 for PROC LIFEREG

This code is also available in: Deutsch Español Français
Awaiting validation
This SAS© script illustrates the use of the LIFEREG procedure for survival data analysis. It defines a 'Micro' dataset internally via datalines, then applies a lognormal lifetime regression model to variables 't1' and 't2', using 'f' as a weighting variable. The script also activates ODS graphical output and generates detailed probability plots with specific options for displaying model results.
Data Analysis

Type : CREATION_INTERNE


The 'Micro' dataset data is created directly within the SAS script using a `datalines` statement in a `DATA STEP` block. Variables `t1` and `t2` represent time intervals, and `f` is a frequency variable.

1 Code Block
DATA STEP Data
Explanation :
This `DATA STEP` block is responsible for creating the 'Micro' dataset. It reads three numeric variables: `t1` (start time or lower event time), `t2` (end time or upper event time) and `f` (frequency or weight). The data is provided directly in the script via the `datalines` statement.
Copied!
1DATA Micro;
2 INPUT t1 t2 f;
3 DATALINES;
4. 6 6
56 12 2
612 24 0
724 48 2
824 . 1
948 168 1
1048 . 839
11168 500 1
12168 . 150
13500 1000 2
14500 . 149
151000 2000 1
161000 . 147
172000 . 122
18;
19 
2 Code Block
PROC LIFEREG
Explanation :
This block executes the `LIFEREG` procedure to fit a lifetime regression model to the 'Micro' dataset survival data. The `ods graphics on;` statement enables graphic generation. The `model` statement specifies `t1` and `t2` as time variables and assumes a lognormal distribution (`d=lognormal`), with initial values for the intercept (`intercept=25`) and the scale parameter (`scale=5`). The `f` variable is used as a weighting factor. The `probplot` subcommand generates probability plots with several options: `pupper` sets the upper limit of the axis, `itprintem` displays EM iterations, `printprobs` displays probabilities, `maxitem` controls the maximum number of items displayed, and `ppout` writes the plot values to a new dataset. The `inset` statement adds an inset to the graph.
Copied!
1ods graphics on;
2PROC LIFEREG DATA=Micro;
3 model ( t1 t2 ) = / d=lognormal intercept=25 scale=5;
4 weight f;
5 probplot
6 pupper = 10
7 itprintem
8 printprobs
9 maxitem = (1000,25)
10 ppout;
11 inset;
12RUN;
13 
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