Hi,
We want to create rolling windows of time series data. We are able to do this for one ID, however we are unsure how to group for multiple IDs
The following code works for one ID and is taken from http://www.lexjansen.com/nesug/nesug12/fi/fi08.pdf:
DATA rwin / view=rwin;
ws = 52;
nwin = nrecs - ws +1;
do w=1 to nwin;
do p=w to w + ws -1;
set have point=p nobs=nrecs;
output;
end;
end;
stop;
run;
proc reg data=rwin noprint outest=stats tableout;
by w;
model y=x1 x2;
quit;