作者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)
1F:推 bugle:sorry函数下错了, count请改为sum 04/29 19:53
2F:推 iinnttww:感谢阿~~看来SQL真的很方便 05/13 08:11