Obsidian | Level 7

Build recursive data for forecasting

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.

4 REPLIES 4
Super User

Re: Build recursive data for forecasting

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.

Obsidian | Level 7

Re: Build recursive data for forecasting

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"!

Super User

Re: Build recursive data for forecasting

@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"!

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:

https://communities.sas.com/t5/SAS-Communities-Library/How-to-create-a-data-step-version-of-your-dat...

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.

http://support.sas.com/documentation/cdl/en/etsug/63939/HTML/default/viewer.htm#etsug_expand_sect026...

Obsidian | Level 7

Re: Build recursive data for forecasting

Reeza, thanks for your willing to help.

I tried something else suggested by other user in the other forum. Thanks again.
Discussion stats
• 4 replies
• 757 views
• 1 like
• 2 in conversation