if you dont want to use any PROC like SQL and SORT, then hash object can be used here in just one DATA step:
data want;
if _N_=1 then do;
declare hash h();
h.defineKey('ID');
h.defineData('ndup');
h.defineDone();
call missing(ndup);
do _i_=1 to nobs;
set have point=_i_ nobs=nobs;
if h.find()^=0 then do;
ndup=1;
h.add();
end;
else do;
ndup=ndup+1;
h.replace();
end;
end;
end;
set have;
if h.find()=0 and ndup=1 then do;
drop ndup;
output;
end;
run;
... View more