Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

- Home
- /
- Analytics
- /
- Forecasting
- /
- Build recursive data for forecasting

Options

- RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Posted 11-01-2017 10:38 AM
(1395 views)

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

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

@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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- RSS Feed
- Permalink
- Report Inappropriate Content

Reeza, thanks for your willing to help.

I tried something else suggested by other user in the other forum. Thanks again.

I tried something else suggested by other user in the other forum. Thanks again.

**SAS Innovate 2025** is scheduled for May 6-9 in Orlando, FL. Sign up to be **first to learn** about the agenda and registration!

Multiple Linear Regression in SAS

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.