The script begins with the generation of a synthetic dataset named 'Mono1' containing missing values in the 'y1' variable. Then, it uses PROC MI to impute these missing values. The chosen imputation method is monotone regression with displayed details. Particular consideration is given to Missing Not At Random (MNAR) data on 'y1', modeled according to the treatment group 'Trt' when 'Trt' is equal to '0'. The imputed dataset is saved in 'outex15'. PROC PRINT procedures are used to display an overview of the original and imputed data.
Datenanalyse
Type : CREATION_INTERNE
The initial dataset 'Mono1' is created directly in the script via a DATA STEP using random number generation functions (rannor, ranuni). The 'outex15' dataset is the result of the imputation performed by PROC MI.
1 Codeblock
DATA STEP Data
Erklärung : This DATA STEP block creates the 'Mono1' dataset. It generates observations for two treatment groups (Trt=0 and Trt=1) with 'y0' and 'y1' variables. The 'y1' variable is conditionally made missing (value '.') for approximately 30% of observations, thus simulating a missing data scenario.
Kopiert!
data Mono1;
do Trt=0 to 1;
do j=1 to 5;
y0=10 + rannor(999);
y1= y0 + Trt + rannor(999);
if (ranuni(999) < 0.3) then y1=.;
output;
end; end;
do Trt=0 to 1;
do j=1 to 45;
y0=10 + rannor(999);
y1= y0 + Trt + rannor(999);
if (ranuni(999) < 0.3) then y1=.;
output;
end; end;
drop j;
run;
1
DATA 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;
18
RUN;
2 Codeblock
PROC PRINT
Erklärung : This PROC PRINT displays the first 10 observations of the 'Mono1' dataset to provide an overview of the data structure before imputation. Only the 'Trt', 'Y0', and 'Y1' variables are included in the output.
Kopiert!
proc print data=Mono1(obs=10);
var Trt Y0 Y1;
title 'First 10 Obs in the Trial Data';
run;
1
PROC PRINTDATA=Mono1(obs=10);
2
var Trt Y0 Y1;
3
title 'First 10 Obs in the Trial Data';
4
RUN;
3 Codeblock
PROC MI
Erklärung : This PROC MI performs multiple imputation of missing values in the 'Mono1' dataset. It uses seed '14823' for reproducibility and generates 15 imputed datasets, stored in 'outex15'. The 'monotone reg' method is specified for monotone regression imputation, with the 'details' option for additional information. The 'mnar' clause indicates that 'y1' is Missing Not At Random, and its model is conditioned on 'Trt' being '0'.
Kopiert!
proc mi data=Mono1 seed=14823 nimpute=15 out=outex15;
class Trt;
monotone reg (/details);
mnar model( y1 / modelobs= (Trt='0'));
var y0 y1;
run;
Erklärung : This PROC PRINT displays the first 10 observations of the imputed dataset 'outex15'. This allows visualizing the results of the multiple imputation performed by PROC MI.
Kopiert!
proc print data=outex15(obs=10);
title 'First 10 Observations of the Imputed Data Set';
run;
1
2
PROC PRINT
3
DATA=outex15(obs=10);
4
title 'First 10 Observations of the Imputed
5
Data Set';
6
RUN;
7
Dieses Material wird von We Are Cas "wie besehen" zur Verfügung gestellt. Es gibt keine ausdrücklichen oder stillschweigenden Garantien hinsichtlich der Marktgängigkeit oder Eignung für einen bestimmten Zweck in Bezug auf die hierin enthaltenen Materialien oder Codes. We Are Cas ist nicht verantwortlich für Fehler in diesem Material, wie es jetzt existiert oder existieren wird, noch bietet We Are Cas technischen Support dafür an.
Urheberrechtsinformationen : SAS SAMPLE LIBRARY
Zugehörige Dokumentation
Aucune documentation spécifique pour cette catégorie.
SAS und alle anderen Produkt- oder Dienstleistungsnamen von SAS Institute Inc. sind eingetragene Marken oder Marken von SAS Institute Inc. in den USA und anderen Ländern. ® zeigt die Registrierung in den USA an. WeAreCAS ist eine unabhängige Community-Site und nicht mit SAS Institute Inc. verbunden.
Diese Website verwendet technische und analytische Cookies, um Ihre Erfahrung zu verbessern.
Mehr erfahren.