BookmarkSubscribeRSS Feed
merton76
Fluorite | Level 6

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;

1 REPLY 1
Ksharp
Super User

Post your test data and the output you need .

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 789 views
  • 0 likes
  • 2 in conversation