作者west1996 ()
看板Statistics
标题Re: [问题] SAS 挑选资料
时间Tue Mar 20 23:35:31 2012
※ 引述《mulala (mm)》之铭言:
: 资料如下:
: X Y
: 1 0
: 1 1
: 2 0
: 2 0
: 3 1
: 3 0
: 只要Y变数是1,则根据X群组挑选资料,挑选结果如下:
: X Y
: 1 0
: 1 1
: 3 1
: 3 0
: 想请大家帮我解决这个问题,谢谢.
proc sql;
create table new as
select *
from old
where x in (select distinct x from old where y eq 1);
quit;
ps.不知道Y是文字型还是数字型,语法以数字型为例,若为文字型where里面请加引号
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 111.243.7.51
1F:推 mulala:成功了,感谢你:) 03/21 17:16