그냥 쉽게 한번 작성해 봤습니다.
추가로 하시고자 하는 부분이 있으시면 이 코드를 기반으로 조금씩 수정하셔서 사용하시면 될 듯 합니다.
data tmp01;
input id $ item $;
datalines;
1 a
1 b
1 c
1 d
2 a
2 a
2 a
2 a
run;
proc sort data=tmp01 out=tmpa nodupkey;
by id;
where item='a';
run;
proc sort data=tmp01 out=tmpbcd nodupkey;
by id;
where item in ('b','c','d');
run;
data final;
merge tmpa(in=in1) tmpbcd(in=in2);
by id;
if not in2;
run;
proc print data=work.final;
run;