SAS中文论坛

标题: 请达人看个代码问题所在 [打印本页]

作者: shiyiming    时间: 2009-10-22 00:12
标题: 请达人看个代码问题所在
选出来和a0001所选的所有课程都相同的id(也就是a0003)
我写的代码既有a0003,又有a0004,请问问题出在哪里?谢谢

[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]
作者: shiyiming    时间: 2009-10-22 02:34
标题: Re: 请达人看个代码问题所在
死猪头




欢迎光临 SAS中文论坛 (https://mysas.net/forum/) Powered by Discuz! X3.2