作者KnightX (........)
看板Statistics
標題Re: [問題] SAS砍遺漏值與算公司數?
時間Wed Apr 29 16:56:52 2009
proc sql;
create table abc2 as
select *
from abc
where code not in (
select code
from abc
where roe = .
);
select count(distinct code) as 公司數
from 第二小題的資料;
quit;
※ 引述《bugle (低點)》之銘言:
: proc sql;
: create table work.temp as
: select *
: from abc
: where code in (
: select code, count(case when roe = . then 1 else 0 end) as cnt
: from abc
: group by 1
: having cnt = 0
: )
: ;
: quit;
另外 b 大的這支程式好像會出現:
ERROR: A subquery cannot select more than one column.
ERROR: A Composite expression (usually a subquery) is used incorrectly
in an expression.
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 210.241.14.158
※ 編輯: KnightX 來自: 210.241.14.158 (04/29 17:17)
推 bugle:sorry函數下錯了, count請改為sum 04/29 19:53
推 iinnttww:感謝阿~~看來SQL真的很方便 05/13 08:11