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 .

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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
  • 1409 views
  • 0 likes
  • 2 in conversation