When using the EM statement in PROC MI, always check the iteration history (ITPRINT option) to ensure convergence. If the algorithm fails to converge within the default number of iterations, it usually indicates a high proportion of missing data or a near-singular covariance matrix, which might require you to increase the MAXITER value or provide a better starting value.
The script begins by creating a dataset named `Fitness1` containing fitness measurements (Oxygen, RunTime, RunPulse). Some of these measurements are deliberately missing to simulate an incomplete data pattern. Then, the `PROC MI` procedure is called with the `nimpute=0` option to not perform imputation, but to use the EM algorithm to estimate the mean, standard deviation, and correlation matrix of the variables. The results of this estimation are stored in the `outem` table, which is finally displayed with `PROC PRINT`.
Data Analysis
Type : INTERNAL_CREATION
Data is created directly in the script via a DATA step with a `datalines` statement. The `Fitness1` dataset is therefore entirely self-contained.
1 Code Block
DATA STEP Data
Explanation : This DATA STEP block creates the `Fitness1` table by reading the data provided via `datalines`. It defines three numerical variables: `Oxygen`, `RunTime`, and `RunPulse`. The double trailing at `@@` at the end of the `input` statement allows reading multiple observations from the same data line.
Explanation : The `PROC MI` statistical procedure analyzes missing data in `Fitness1`. The `nimpute=0` option specifies not to create imputed datasets. The `em` statement requests the calculation of estimates based on the Expectation-Maximization (EM) algorithm, which are saved in a new table named `outem`. The `seed` option ensures reproducibility and `simple` requests basic descriptive statistics.
Copied!
proc mi data=Fitness1 seed=1518971 simple nimpute=0;
em itprint outem=outem;
var Oxygen RunTime RunPulse;
run;
Explanation : This block displays the content of the `outem` table, which contains the estimates (means, covariances) calculated by the `PROC MI` procedure.
Copied!
proc print data=outem;
title 'EM Estimates';
run;
1
2
PROC PRINT
3
DATA=outem;
4
title 'EM Estimates';
5
RUN;
6
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
Related Documentation
Aucune documentation spécifique pour cette catégorie.
SAS and all other SAS Institute Inc. product or service names are registered trademarks or trademarks of SAS Institute Inc. in the USA and other countries. ® indicates USA registration. WeAreCAS is an independent community site and is not affiliated with SAS Institute Inc.
This site uses technical and analytical cookies to improve your experience.
Read more.