The script begins by creating a 'Fish1' dataset containing fish length measurements, where some values have been intentionally set to missing to create a monotonic pattern. Then, the PROC MI procedure is used to perform multiple imputation (8 imputations are generated). It uses standard regression for the 'Length2' variable and a predictive mean matching (PMM) method for 'Length3'. The results are stored in the 'outex3' table. Finally, the first 10 rows of the imputed dataset are displayed for verification.
Data Analysis
Type : CREATION_INTERNE
The 'Fish1' dataset is created directly within the script using a DATA STEP statement and DATALINES.
1 Code Block
DATA STEP Data
Explanation : This code block creates the 'Fish1' table. It reads three numeric variables (Length1, Length2, Length3) from data embedded directly via 'datalines'. Some observations have missing values (represented by '.') to simulate an incomplete dataset with a monotonic pattern.
Explanation : This procedure performs multiple imputation on the 'Fish1' table. 'nimpute=8' requests the creation of 8 imputed datasets. The 'monotone' method is specified, with regression ('reg') for 'Length2' and predictive mean matching regression ('regpmm') for 'Length3'. The 'seed' is fixed for reproducibility. The result is saved in the 'outex3' table.
Explanation : This block displays the first 10 observations of the 'outex3' dataset, which contains the values imputed by PROC MI, allowing for quick verification of the result.
Copied!
proc print data=outex3(obs=10);
title 'First 10 Observations of the Imputed Data Set';
run;
1
2
PROC PRINT
3
DATA=outex3(obs=10);
4
title 'First 10 Observations of the Imputed
5
Data Set';
6
RUN;
7
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.
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.