If your goal is to ultimately assign each observation to its respective missing data pattern then the easiest way I can think of to do this is to use Proc IML in conjunction with the missing data pattern ODS table. Below is what I have in mind.
data Fitness1;
input Oxygen RunTime RunPulse @@;
datalines;
44.609 11.37 178 45.313 10.07 185
54.297 8.65 156 59.571 . .
49.874 9.22 . 44.811 11.63 176
. 11.95 176 . 10.85 .
39.442 13.08 174 60.055 8.63 170
50.541 . . 37.388 14.03 186
44.754 11.12 176 47.273 . .
51.855 10.33 166 49.156 8.95 180
40.836 10.95 168 46.672 10.00 .
46.774 10.25 . 50.388 10.08 168
39.407 12.63 174 46.080 11.17 156
45.441 9.63 164 . 8.92 .
45.118 11.08 . 39.203 12.88 168
45.790 10.47 186 50.545 9.93 148
48.673 9.40 186 47.920 11.50 170
47.467 10.50 170
;
proc mi data=Fitness1 seed=1518971 simple nimpute=0;
var Oxygen RunTime RunPulse;
ods output MissPattern=mdpattern;
run;
proc iml;
/*Read in original data set*/
use fitness1;
read all var{Oxygen RunTime RunPulse} into dat[colname=cname];
/*Generate the observation level missing data pattern*/
misspattern=missing(dat);
/*Read in the Summarized form from Proc MI*/
use mdpattern;
read all var {Oxygen_miss RunTime_miss RunPulse_miss} into sumpattern;
/*Read in the group number*/
read all var{group} into grp;
/*Reformat the MI data set so that it has 0s and 1s instead of Xs and .s to make the comparison easier*/
sumpattern=(sumpattern='.');
/*Compare each of the rows to the patterns*/
x=j(nrow(dat),1,.);
do j=1 to nrow(dat);
do i=1 to nrow(sumpattern);
if misspattern[j,]=sumpattern[i,] then x[j]=grp[i];
end;
end;
/*Save the pattern as a variable in the original data set*/
datx=dat||x;
create fitness2 from datx [colname= (cname||'patnum')];
append from datx;
quit;
proc print data=fitness2;
run;
... View more