This script illustrates how to perform multiple imputation when missing data are assumed to be Missing Not At Random (MNAR). It begins by creating a synthetic dataset ('Fcs1') with simulated missing values. Then, it uses `PROC MI` with the `FCS` (Fully Conditional Specification) option and the `MNAR` statement to adjust the imputed values of variables `y1` and `y2` specifically for the treatment group `Trt='1'`, by applying shifts.
Analyse des données
Type : CREATION_INTERNE
The data are artificially generated in the DATA step `Fcs1` using loops and random number generation functions (`rannor`, `ranuni`) to simulate clinical trial data.
1 Bloc de code
DATA STEP Data
Explication : Creation of the `Fcs1` dataset. Generates `y0`, `y1`, `y2` variables based on a normal distribution and randomly introduces missing values (`.`) for `y1` or `y2`.
Copié !
data Fcs1;
do Trt=0 to 1;
do j=1 to 5;
y0=10 + rannor(99);
y1= y0 + 0.9*Trt + rannor(99);
y2= y0 + 0.9*Trt + rannor(99);
if (ranuni(99) < 0.3) then y1=.;
else if (ranuni(99) < 0.3) then y2=.;
output;
end; end;
do Trt=0 to 1;
do j=1 to 45;
y0=10 + rannor(99);
y1= y0 + 0.9*Trt + rannor(99);
y2= y0 + 0.9*Trt + rannor(99);
if (ranuni(99) < 0.3) then y1=.;
else if (ranuni(99) < 0.3) then y2=.;
output;
end; end;
drop j;
run;
1
DATA Fcs1;
2
DO Trt=0 to 1;
3
DO j=1 to 5;
4
y0=10 + rannor(99);
5
y1= y0 + 0.9*Trt + rannor(99);
6
y2= y0 + 0.9*Trt + rannor(99);
7
IF (ranuni(99) < 0.3) THEN y1=.;
8
ELSEIF (ranuni(99) < 0.3) THEN y2=.;
9
OUTPUT;
10
END; END;
11
DO Trt=0 to 1;
12
DO j=1 to 45;
13
y0=10 + rannor(99);
14
y1= y0 + 0.9*Trt + rannor(99);
15
y2= y0 + 0.9*Trt + rannor(99);
16
IF (ranuni(99) < 0.3) THEN y1=.;
17
ELSEIF (ranuni(99) < 0.3) THEN y2=.;
18
OUTPUT;
19
END; END;
20
drop j;
21
RUN;
2 Bloc de code
PROC PRINT
Explication : Displays the first 10 observations of the generated dataset for verification.
Copié !
proc print data=Fcs1(obs=10);
var Trt Y0 Y1 Y2;
title 'First 10 Obs in the Trial Data';
run;
1
PROC PRINTDATA=Fcs1(obs=10);
2
var Trt Y0 Y1 Y2;
3
title 'First 10 Obs in the Trial Data';
4
RUN;
3 Bloc de code
PROC MI Data
Explication : Performs multiple imputation. Uses the `FCS` method with 25 iterations. The `MNAR` statement applies an adjustment (shift of -0.4 for `y1` and -0.5 for `y2`) only for observations where `Trt='1'`, simulating a bias for missing data.
Copié !
proc mi data=Fcs1 seed=52387 out=outex16;
class Trt;
fcs nbiter=25 reg( /details);
mnar adjust( y1 /shift=-0.4 adjustobs=(Trt='1'))
adjust( y2 /shift=-0.5 adjustobs=(Trt='1'));
var Trt y0 y1 y2;
run;
1
PROC MIDATA=Fcs1 seed=52387 out=outex16;
2
class Trt;
3
fcs nbiter=25 reg( /details);
4
mnar adjust( y1 /shift=-0.4 adjustobs=(Trt='1'))
5
adjust( y2 /shift=-0.5 adjustobs=(Trt='1'));
6
var Trt y0 y1 y2;
7
RUN;
4 Bloc de code
PROC PRINT
Explication : Displays the first 10 observations of the output dataset `outex16`, which contains the imputed data.
Copié !
proc print data=outex16(obs=10);
var _Imputation_ Trt y0 y1 y2;
title 'First 10 Observations of the Imputed Data Set';
run;
1
PROC PRINTDATA=outex16(obs=10);
2
var _Imputation_ Trt y0 y1 y2;
3
title 'First 10 Observations of the Imputed Data Set';
4
RUN;
Ce matériel est fourni "tel quel" par We Are Cas. Il n'y a aucune garantie, expresse ou implicite, quant à la qualité marchande ou à l'adéquation à un usage particulier concernant le matériel ou le code contenu dans les présentes. We Are Cas n'est pas responsable des erreurs dans ce matériel tel qu'il existe maintenant ou existera, et We Are Cas ne fournit pas de support technique pour celui-ci.
Informations de Copyright : SAS SAMPLE LIBRARY, NAME: MIEX16, PRODUCT: STAT
Documentation liée
Aucune documentation spécifique pour cette catégorie.
SAS et tous les autres noms de produits ou de services de SAS Institute Inc. sont des marques déposées ou des marques de commerce de SAS Institute Inc. aux États-Unis et dans d'autres pays. ® indique un enregistrement aux États-Unis. WeAreCAS est un site communautaire indépendant et n'est pas affilié à SAS Institute Inc.
Ce site utilise des cookies techniques et analytiques pour améliorer votre expérience.
En savoir plus.