Example 12 for PROC MIANALYZE: MNAR Sensitivity Analysis

This code is also available in: Deutsch Español Français
Difficulty Level
Beginner
Published on :
The script first generates a simulated dataset (Mono1) with arbitrary missing values. It then performs two distinct analyses to compare results: a first standard multiple imputation (MAR - Missing At Random) followed by linear regression and combined analysis, then a second approach using an MNAR adjustment to model Missing Not At Random data, also followed by regression and synthesis of results via PROC MIANALYZE.
Data Analysis

Type : CREATION_INTERNE


The 'Mono1' dataset is generated entirely in the first DATA step using loops and random functions (rannor, ranuni).

1 Code Block
DATA STEP Data
Explanation :
Creation of the 'Mono1' dataset simulating clinical trial data with two treatment groups (Trt). Missing values are artificially introduced into variable y1.
Copied!
1DATA Mono1;
2 DO Trt=0 to 1;
3 DO j=1 to 5;
4 y0=10 + rannor(999);
5 y1= y0 + Trt + rannor(999);
6 IF (ranuni(999) < 0.3) THEN y1=.;
7 OUTPUT;
8 END; END;
9 
10 DO Trt=0 to 1;
11 DO j=1 to 45;
12 y0=10 + rannor(999);
13 y1= y0 + Trt + rannor(999);
14 IF (ranuni(999) < 0.3) THEN y1=.;
15 OUTPUT;
16 END; END;
17 drop j;
18RUN;
2 Code Block
PROC PRINT
Explanation :
Display of the first 10 observations to verify the generated data.
Copied!
1PROC PRINT DATA=Mono1(obs=10);
2 var Trt Y0 Y1;
3 title 'First 10 Obs in the Trial Data';
4RUN;
3 Code Block
PROC MI Data
Explanation :
First execution of multiple imputation (20 imputations) assuming a monotone pattern and a standard regression method. Imputed data is saved in 'outex12a'.
Copied!
1PROC MI DATA=Mono1 seed=14823 nimpute=20 out=outex12a;
2 class Trt;
3 monotone reg;
4 var Trt y0 y1;
5RUN;
4 Code Block
PROC REG Data
Explanation :
Execution of a linear regression model on each imputed dataset (via the BY _Imputation_ group). Parameter estimates are exported to the 'regparms' table.
Copied!
1ods select none;
2PROC REG DATA=outex12a;
3 model y1= Trt y0;
4 BY _Imputation_;
5 ods OUTPUT parameterestimates=regparms;
6RUN;
7ods select all;
5 Code Block
PROC MIANALYZE
Explanation :
Combination of the results of the 20 regressions to produce valid statistical inferences (Rubin's rules) for the first approach.
Copied!
1 
2PROC MIANALYZE parms=regparms;
3modeleffects Trt;
4RUN;
5 
6 Code Block
PROC MI Data
Explanation :
Second execution of multiple imputation. This time, the MNAR statement is used to specify a model for Missing Not At Random data on variable y1, specifically for the Trt=0 group.
Copied!
1PROC MI DATA=Mono1 seed=14823 nimpute=20 out=outex12b;
2 class Trt;
3 monotone reg;
4 mnar model( y1 /modelobs=(Trt='0'));
5 var y0 y1;
6RUN;
7 Code Block
PROC REG Data
Explanation :
Linear regression on data from MNAR imputation, repeated by imputation.
Copied!
1ods select none;
2PROC REG DATA=outex12b;
3 model y1= Trt y0;
4 BY _Imputation_;
5 ods OUTPUT parameterestimates=regparms;
6RUN;
7ods select all;
8 Code Block
PROC MIANALYZE
Explanation :
Final combination of results for the MNAR approach.
Copied!
1 
2PROC MIANALYZE parms=regparms;
3modeleffects Trt;
4RUN;
5 
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


Related Documentation

Aucune documentation spécifique pour cette catégorie.