[code:1dxwydp5]data b(drop=del_flag);
do _n_=1 by 1 until(last.id);
set a;
by id;
if type=0 then del_flag=1;
end;
do _n_=1 to _n_;
set a;
if del_flag~=1 then output;
end;
run;[/code:1dxwydp5]
data a;
input ID$ Num type;
cards;
001 1 1
001 2 1
001 3 1
002 2 1
002 1 0
002 2 1
003 1 1
003 4 1
;
run;
proc sql;
select * from a where id ^= (select distinct id from a where type=0);
quit;