楼主: wdxmahone
5578 20

sas如何删除前面为0的项 [推广有奖]

21
shenliang_111 发表于 2011-8-21 09:11:22
try this:
data a;
input x y @@;
cards;
1 0
1 0
1 -1
1 0
1 1
2 0
2 0
2 6
2 7
2 0
2 9
;
run;
data a;
do _n_=1  by  1 until(last.x);
set a;
by x;
k=_n_;
output;
end;
run;
proc sql;
create table new
as select x,min(k)as k
from a
where y ne 0
group by x
order by x;
quit;
proc sql;
create table result as
select a.x,a.y from a inner join new
on a.x=new.x and a.k ge new.k;
quit;

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2025-12-29 12:12