作者liton (欧吉桑留学生)
看板Statistics
标题Re: [问题] SAS资料处理
时间Tue Feb 24 01:55:15 2009
Proc Sql;
create table group as
select group, type
from source
where group in
(select group, count(distinct type) from source
group by group
having count(distinct type)>1);
quit;
你很多类似问题..
建议你买本入门的SQL
※ 引述《a15321 (a15321)》之铭言:
: 请教各位前辈,我有一组资料
: group type 其他变数...
: 100 A
: 100 B
: 101 A
: 101 A
: 101 B
: 101 B
: 102 A
: 103 B
: 104 A
: 104 A
: group有上万组,type只有两种,
: 我想把资料整理成只剩下,「同一个group同时有A与B两种type」的group
: 也就是上面的data能整理成留下
: group type
: 100 A
: 100 B
: 101 A
: 101 A
: 101 B
: 101 B
: 我目前想到的作法是
: 先以group排序,然後用 if First.group and Last.group then delete;
: 就能删除只有一组资料的group。
: 但剩下 同一个group里数组资料都是A type或都是B type的部份
: 就不知道怎麽抓出来删除了...
: 可否请板上前辈们给点提示 感谢!
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 118.167.170.118
※ 编辑: liton 来自: 118.167.170.118 (02/24 01:59)
1F:推 ayung0508:可以请推荐几本门SQL好书吗? 02/24 02:11