再试试,奶奶的.
proc import out=tmp
datafile='e:\test.xls' dbms=excel replace;
run;
data tmp2;
set tmp;
year=input(substr(strip(date),1,4),??best.);
month=input(substr(strip(date),5),??best.);
run;
proc sort; by company product year month; run;
data tmp3;
set tmp2;
by company product year month;
_lagy=lag(year);
_lagm=lag(month);
if first.product=0 then do;
obs=_n_-1;
do i = 1 to (12*(year-_lagy)+(month-_lagm)-1);
set tmp2 point=obs;
month=month+i; year=year+ceil(month/12)-1;
month=mod(month,12);
if month=0 then month=12;
output;
end;
end;
run;
data tmp4(drop=_lagy _lagm i);
set tmp2 tmp3;
run;
proc sort; by company product year month; run;


雷达卡

京公网安备 11010802022788号







