※ 引述《maryastro (麥豬不要跑)》之銘言:
: [軟體程式類別]:
: sas
: [程式問題]:
: 資料處理
: [軟體熟悉度]:
: 中(3個月到1年)
: [問題敘述]:
: id stroke_id
: 1 1
: 1 0
: 2 0
: 2 0
: 3 0
: 3 1
: 4 0
: 4 0
: 想請問大家
: 有哪一個sas的指令可以告訴它
: 如果stroke_id曾經有1的
: 就要刪除掉這個id的所有紀錄
: 也就是新檔案我只需要keep id 2和4的資料就好了
: 我目前只想到一個土方法
: if stroke_id=1 then output;
: 給予一個新變項(stroke=1)告知說這id有stroke
: merge回原始的檔案
: 如果stroke =1 then delete;
: 我想請問有比較簡單的code可以直接進行刪除掉id=1, 3的資料嗎?
: 因為這個方法太繞圈圈了
: 老闆好像不喜歡
: 謝謝
: -----------------------------------------------------------------------------
proc sql;
create table new as
select *
from old
where id not in (select distinct id from old where stroke_id eq '1');
quit;
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 111.243.14.53