The following demonstrates how results from PROC GLM are read into PROC MIANALYZE. The data from the example titled "PROC GLM for Unbalanced ANOVA" in the Getting Started section of the GLM documentation is used below and missing values are introduced into the data for the purposes of illustrating the use of the MI and MIANALYZE procedures.
data exp;
input A $ B $ Y @@;
datalines;
A1 B1 12 A1 B1 . A1 B2 11 A1 B2 9
A2 B1 20 A2 B1 18 A2 B2 .
;
To impute the missing values in the response variable, the monotone regression method is employed by PROC MI in the statements below. Five imputations, which is the default, are done. This code results in a WARNING message regarding the imputation method for variables A and B that can be ignored because neither is being imputed.
proc mi data=exp nimpute=5 seed=10 out=exp_imp;
class a b;
monotone regression;
var a b y;
run;
Parameter Estimates with CLASS variables included in the model
Suppose there are CLASS variables in the model and you want to combine the parameter estimates from multiple imputations. For example, the following PROC GLM step fits a 2x2 factorial model and saves the Parameter Estimates table to a data set.
proc glm data=exp_imp;
by _imputation_;
class A B;
model Y = A B A*B / solution;
ods output ParameterEstimates=parms_glm;
run;
The following statements display the Parameter Estimates table from the first imputation. Note that it does not match any of the formats required by the CLASSVAR= option in PROC MIANALYZE. See "Input Data Sets" in the Details section of the MIANALYZE documentation. Specifically, the PARAMETER variable records each parameter as its
effect name (A, B, or A*B) followed by its associated variable level(s) separated by spaces.
proc print data=parms_glm noobs;
where _imputation_=1;
var _imputation_ parameter estimate stderr;
run;
1 |
Intercept |
21.59419367 |
2.65157885 |
1 |
A A1 |
-11.59419367 |
3.24750760 |
1 |
A A2 |
0.00000000 |
. |
1 |
B B1 |
-2.59419367 |
3.24750760 |
1 |
B B2 |
0.00000000 |
. |
1 |
A*B A1 B1 |
1.67078716 |
4.19251429 |
1 |
A*B A1 B2 |
0.00000000 |
. |
1 |
A*B A2 B1 |
0.00000000 |
. |
1 |
A*B A2 B2 |
0.00000000 |
. |
|
In order for PROC MIANALYZE to use this table it is necessary to modify the PARAMETER variable such that its value in each row is a valid SAS name. The following DATA step uses the SCAN function to pick out the first level (second word) in the PARAMETER variable. The INDEXW function then finds the position of the first level. The SUBSTR function selects from that position to the end which is the list of levels. This effectively removes the effect name from the beginning of PARAMETER. Finally, the COMPRESS function removes blanks from the levels list and prepends 'p' to ensure that the final value in PARAMETER is a valid SAS name when levels are numeric.
data parms_glm;
set parms_glm;
if parameter ne 'Intercept' then do;
FirstLevel = scan(parameter,2,' ');
LevelsPos = indexw(parameter,FirstLevel);
LevelsList = substr(parameter,LevelsPos);
parameter = 'p'||compress(LevelsList);
end;
run;
proc print data=parms_glm noobs;
where _imputation_=1;
var _imputation_ parameter estimate stderr;
run;
1 |
Intercept |
21.59419367 |
2.65157885 |
1 |
pA1 |
-11.59419367 |
3.24750760 |
1 |
pA2 |
0.00000000 |
. |
1 |
pB1 |
-2.59419367 |
3.24750760 |
1 |
pB2 |
0.00000000 |
. |
1 |
pA1B1 |
1.67078716 |
4.19251429 |
1 |
pA1B2 |
0.00000000 |
. |
1 |
pA2B1 |
0.00000000 |
. |
1 |
pA2B2 |
0.00000000 |
. |
|
Now that values of the PARAMETER variable are SAS names, you can list these names in the MODELEFFECTS statement in PROC MIANALYZE. The CLASS statement is not needed since the parameters are individually named. Also, because of the full-rank parameterization that the CLASS statement in GLM uses, it is necessary to leave the parameters that have been set to zero out of the list specified in the MODELEFFECTS statement. Further, note that because neither the TEST statement nor the MULT option is specified in MIANALYZE it is not necessary to specify the COVB= data set as long as the PARMS= data set contains the estimates and standard errors.
proc mianalyze parms=parms_glm;
modeleffects intercept pa1 pb1 pa1b1;
ods select ParameterEstimates;
run;
Only the parameter estimates from MIANALYZE are shown below.
17.177626 |
3.378031 |
9.1382 |
25.21710 |
6.7846 |
14.848952 |
21.594194 |
0 |
5.09 |
0.0016 |
-7.177626 |
3.568715 |
-15.3312 |
0.97599 |
8.4512 |
-11.594194 |
-4.848952 |
0 |
-2.01 |
0.0772 |
1.822374 |
3.568715 |
-6.3312 |
9.97599 |
8.4512 |
-2.594194 |
4.151048 |
0 |
0.51 |
0.6227 |
-0.340953 |
2.977855 |
-6.2928 |
5.61086 |
62.438 |
-1.568945 |
1.670787 |
0 |
-0.11 |
0.9092 |
|
Combining Results from ESTIMATE statements
It is also possible to combine the results from ESTIMATE statements. This is illustrated by adding two ESTIMATE statements to the example above. The ODS OUTPUT statement saves the results of the ESTIMATE statements in a data set.
proc glm data=exp_imp;
by _imputation_;
class A B;
model Y=A B A*B/solution;
estimate 'A1 vs A2 in B1' a 1 -1 a*b 1 0 -1 0;
estimate 'A1 vs A2 in B2' a 1 -1 a*b 0 1 0 -1;
ods output estimates=est_ds;
run;
In order to properly combine the results from the ESTIMATE statements, it is necessary to sort the EST_DS data set by the PARAMETER variable as well as by _IMPUTATION_.
proc sort data=est_ds;
by parameter _imputation_;
run;
To get the two combined estimates, a BY statement is needed in MIANALYZE. Because GLM uses the variable PARAMETER to identify the different ESTIMATE statements it is necessary to use the the DATA= option rather than the PARMS= option to input the data into MIANALYZE.
proc mianalyze data=est_ds;
by parameter;
modeleffects estimate;
stderr stderr;
ods select ParameterEstimates;
run;
-7.518578 |
2.281823 |
-12.3421 |
-2.69504 |
16.58 |
-9.923407 |
-6.318781 |
0 |
-3.29 |
0.0044 |
-7.177626 |
3.568715 |
-15.3312 |
0.975995 |
8.4512 |
-11.594194 |
-4.848952 |
0 |
-2.01 |
0.0772 |
|
Operating System and Release Information
SAS System | SAS/STAT | z/OS | | |
Z64 | | |
OpenVMS VAX | | |
Microsoft® Windows® for 64-Bit Itanium-based Systems | | |
Microsoft Windows Server 2003 Datacenter 64-bit Edition | | |
Microsoft Windows Server 2003 Enterprise 64-bit Edition | | |
Microsoft Windows XP 64-bit Edition | | |
Microsoft® Windows® for x64 | | |
OS/2 | | |
Microsoft Windows 8 Pro | | |
Microsoft Windows 95/98 | | |
Microsoft Windows 2000 Advanced Server | | |
Microsoft Windows 2000 Datacenter Server | | |
Microsoft Windows 2000 Server | | |
Microsoft Windows 2000 Professional | | |
Microsoft Windows NT Workstation | | |
Microsoft Windows Server 2003 Datacenter Edition | | |
Microsoft Windows Server 2003 Enterprise Edition | | |
Microsoft Windows Server 2003 Standard Edition | | |
Microsoft Windows Server 2003 for x64 | | |
Microsoft Windows Server 2008 | | |
Microsoft Windows Server 2008 for x64 | | |
Microsoft Windows Server 2012 | | |
Microsoft Windows XP Professional | | |
Windows 7 Enterprise 32 bit | | |
Windows 7 Enterprise x64 | | |
Windows 7 Home Premium 32 bit | | |
Windows 7 Home Premium x64 | | |
Windows 7 Professional 32 bit | | |
Windows 7 Professional x64 | | |
Windows 7 Ultimate 32 bit | | |
Windows 7 Ultimate x64 | | |
Windows Millennium Edition (Me) | | |
Windows Vista | | |
Windows Vista for x64 | | |
64-bit Enabled AIX | | |
64-bit Enabled HP-UX | | |
64-bit Enabled Solaris | | |
ABI+ for Intel Architecture | | |
AIX | | |
HP-UX | | |
HP-UX IPF | | |
IRIX | | |
Linux | | |
Linux for x64 | | |
Linux on Itanium | | |
OpenVMS Alpha | | |
OpenVMS on HP Integrity | | |
Solaris | | |
Solaris for x64 | | |
Tru64 UNIX | | |
*
For software releases that are not yet generally available, the Fixed
Release is the software release in which the problem is planned to be
fixed.