SQL怎样输入带有时间滞后的公式
公式的类型是这样的(图片放不出来,我放在评论里吧呜呜)然后按着公式写了这个代码,总是报错
proc sql;
create table demo_2 as
select distinct permno,datadate, csho, ajex,
lag(csho,1,0) over(order by permno) lag_csho1
lag(csho,2,0) over(order by permno) lag_csho2
lag(ajex,1,0) over(order by permno) lag_ajex1
lag(ajex,2,0) over(order by permno) lag_ajex2
log((lag_csho1 * lag_csho2)/(lag_ajex1 * lag_ajex2)) as nsi,ret
from Rdata.funda_1;
quit;