我抛砖引玉,用个笨办法:
data a;
id=1;time=mdy(1,1,2015);months=4;output;
id=2;time=mdy(2,4,2015);months=5;output;
id=3;time=mdy(7,7,2015);months=6;output;
format time yymmdd10.;
run;
data b;
set a;
do i=1 to months;
if month(time)+i<=12 then time1=mdy(month(time)+i,day(time),year(time));
else time1=mdy(month(time)+i-12,day(time),year(time)+1);
output;
end;
format time1 yymmdd10.;
run;
proc sort data=b;
by id time months;
run;
proc transpose data=b out=c prefix=t;
by id time months;
var time1;
run;