Hello all,
I want to build data to be used for recursive regression.
I have 10 countries with each country has 239 months of data,
I want the following collection of 98 recursive windows for EACH country, as follows:
Country 1:
Window 1 has the first 141 observations (first 141 months)
Window 2 has the first 142 observations (first 142 months)
Window 3 has the first 143 observations (first 141 months)
...
Window 98 has the first 239 observations (first 239 months: and this is the full sample period)
Country 2:
Window 1 has the first 141 observations (first 141 months)
Window 2 has the first 142 observations (first 142 months)
Window 3 has the first 143 observations (first 141 months)
...
Window 98 has the first 239 observations (first 239 months: and this is the full sample period)
an so on.....
I don't know how to build the above data set. Any help will be appreciated. Thanks.
1, Post sample data
2. Post what you've tried.
3. Reposting the same question multiple times isn't going to really change the responses.
1- I am attaching my sample data
2- Here is the code I am using:
data roll;
set developingrank;
i=1;do while(i<=141);
output;
rankdate=intnx('month', date, 0)-1;
i=i+1;;
end;
run;
*Note: The "trick" which I want to add in the above code is to pass through the data (ending date) once
3- I have already posted a sample data and my code in the other forum but you replied that "you don't have time to work on something this complex"!
Thanks for your help.
@Yamani wrote:
3- I have already posted a sample data and my code in the other forum but you replied that "you don't have time to work on something this complex"!
Thanks for your help.
You're exactly correct, I'm not going to take the time to download your excel file and write import steps, and then write a macro to do rolling regression. If you provide data in an easy to use format where I can copy and paste it directly into SAS, that means I may have time to actually work with it, here's instructions on how to do that:
Have you looked into PROC EXPAND which may be able to calculate the SSCP (sp?) approach mentioned by someone else? Or at least the values you'd need to calculate that? It ends up being a manual regression each line That solution is beyond me, I'd write a macro to loop through the data. It's not as efficient, but it didn't sound like you have a massive data set.
Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.