Dear community,
I have trouble when I try to write code for rolling window regression for a company. I need to get the estimate for each company within a rolling window of 60-month. I searched for the belowing solution, but it ignores different companies. For example, the last observations of first company A will be computed into the second company B.
What I NEED is for each company, the rolling window regression is computed from the beginning.
Could you please help me to solve this issue, I need improvement for the code. Let the code tell different company when it goes through the rolling window.
Best regards!!!!!!!!!!!!
DATA rwin / view=rwin;
ws = 60;
nwin = nrecs - ws +1;
do w=1 to nwin;
do p=w to w + ws -1;
set part1 point=p nobs=nrecs;
output;
end;
end;
run;
Go to your favorite interent search engine, type in
rolling window regression in sas
and you will find lots of code that has already been written for this problem.
Dear PaigeMiller,
Thanks for your information. However, I really cannot find anything solving the different companies issue.
Best regards
Seems like the other thread on this topic, which you posted in, contains specific code to do this. But I also see a Google search contains other links which also have code for the multiple company part of the problem.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9.
Early bird rate extended! Save $200 when you sign up by March 31.
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.
Ready to level-up your skills? Choose your own adventure.