by stockcode wk date;
run;
data bx;
set b;
by stockcode wk date;
retain wn1 wn2 wn3 wn4;
array wn{4};
if first.stockcode then nw=0;
if first.wk then nw+1;
if last.wk then do;
wnclose=nclose;
if nw<=4 then wn{nw}=wnclose;
else do;
wma5=mean(of wn1-wn4,nclose);
nnw=mod(nw,4);
if nnw=0 then nnw=4;
wn{nnw}=wnclose;
end;
end;
if nw>=5 & ^(last.wk) then wma5=mean(of wn1-wn4,nclose);
drop wn: nnw;
run;
_______________________________________________________________
再来挣个币



雷达卡







京公网安备 11010802022788号







