自己找到答案了,不过是通过sas实现
data ×××;
        set ××××;
        month=month(date);
        if month=11 or month=12 then tag=1;else
        if month=1 or month=2 then tag=2;else
        if month=3 or month=4 then tag=3;else
        if month=5 or month=6 then tag=4;else
        if month=7 or month=8 then tag=5;
    run;
proc reg data=wjd.stk_adjust(where=(tag in (1,2,3,4,5))) noprint;
        model dretnd=idx_dret idx_dret_lag1 idx_dret_lag2 idx_dret_lead1idx_dret_lead2 ;
        by stk_id tag;
        output out=wjd.epsilon residual=r;
run;