[code:2orabq8r]data aa;
input id$5. course $ score;
datalines;
a0001 physics 90
a0002 physics 10
a0002 stat 80
a0003 physics 60
a0001 math 70
a0003 math 30
a0004 physics 20
a0004 stat 80
a0004 math 90
;
run;
proc sql;
select id,count(id) as n
from aa
where course in (select course from aa where id='a0001')
group by id
having n=(select count(id) from aa where id='a0001') and id ne 'a0001';
quit;[/code:2orabq8r]