/************************************************************* * NH3MI.SAS - Handles the tasks of sorting each of the * * IMPx (x=1,...,5) and the CORE data sets, * * and merging them to create five imputed * * data sets NH3MIx.SSD (x=1,...,5). * * * * This program uses a MACRO procedure to * * handle IMPx (x=1,...,5) in turn. * * * * NOTE: You need to run the programs CORE.SAS and each of * * the IMPx.SAS programs before running this program. * *************************************************************/ LIBNAME NH3MI "D:\Multiple Imputations"; /* Edit location to suit your need */ PROC SORT DATA=NH3MI.CORE; BY SEQN; RUN; /************************************************************* * This MACRO will cycle through IMP1-IMP5 automatically * *************************************************************/ %MACRO IMPUTE(NUMBER); /************************************************************* * Recoding the '-9' values to SAS missing values. * *************************************************************/ PROC SORT DATA=NH3MI.IMP&NUMBER; BY SEQN; DATA IMP&NUMBER; SET NH3MI.IMP&NUMBER; ARRAY MISSval DMPPIRMI -- PEP6I3MI; DO OVER MISSval; IF MISSval=-9 THEN MISSval=.; END; /************************************************************* * Merging the CORE with each of the imputed files * *************************************************************/ DATA NH3MI.NH3MI&NUMBER; MERGE NH3MI.CORE IMP&NUMBER; BY SEQN; RUN; %MEND IMPUTE; %IMPUTE(1); %IMPUTE(2); %IMPUTE(3); %IMPUTE(4); %IMPUTE(5);