Re: [問題] SAS資料處理
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)
推
02/24 02:11, , 1F
02/24 02:11, 1F
討論串 (同標題文章)
本文引述了以下文章的的內容:
以下文章回應了本文:
完整討論串 (本文為第 13 之 19 篇):
問題
1
3
問題
1
3
問題
1
1
問題
2
5
問題
1
1
問題
1
3
問題
1
2
問題
3
5