*间隔的天数;
%let interval=2;
data a;
input code day event x;
datalines;
1 02 0 1.9
1 03 0 3.3
1 04 1 -4
1 05 1 18
2 01 0 6
2 02 0 4
2 03 1 7
;
run;
proc sql;
create table result as
select code,day,event,x,
(select sum(x)
from a t2
where t2.code=t1.code and t2.day<t1.day and t2.day>=t1.day-&interval)/&interval
as mean_&interval
from a t1
where event=1
;
quit;


雷达卡




京公网安备 11010802022788号







