To me using a BY statement with NOSTORTED options is a bit easier. Same difference I reckon.
data want;
set have;
by status notsorted;
if first.status then call missing(d);
if status ne: 'em' then do;
d + 1;
if first.status then r+1;
day = d;
round = r;
end;
drop d r;
run;
... View more