If I understand the question correctly:
data miss2;
set miss1;
array idata {5} miss1-miss5;
array dd {5} d1-d5;
d1=0;
unatt_count=0;
do i = 2 to dim(idata);
unatt_count + (idata{i-1} = 0);
if idata{i}=0 then dd{i} = unatt_count;
end;
run;
D1 must be 0, since there can't be any unattended meetings before meeting 1.
MISS5 never gets counted in the unattended count, since it can't be used as a prior meeting. If you want to adjust the final unattended count to examine MISS5 you could add a final statement to the DATA step:
if miss5=0 then unatt_count + 1;
... View more