Turn on suggestions

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

Showing results for

Options

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

🔒 This topic is **solved** and **locked**.
Need further help from the community? Please
sign in and ask a **new** question.

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

Posted 03-04-2019 09:21 AM
(2481 views)

Hello again. I would like to do forecast with regression model.

I use this source code but the result won't come out and I don't know what could be wrong.

proc reg data = armaxvlp;

model Bill = Time DL1 DL2 DL3 D1 D2 D3 D4 D5 D6 Mt/noint;

output out = Res R = Bill_Res;

run;

forecast out = ramalan lead = 12;

run;

proc print data = ramalan (obs = 48);

run;

Thankyou.

1 ACCEPTED SOLUTION

Accepted Solutions

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

If you are fitting a regression on a monthly data set, from 2016 to 2018, and now you want forecasts for 2019, you can get predicted values for 2019 but you need to have all the values of the x-variables in the regression present, plus Waktu must be months in 2019.

In other words, all the variables in

`model Bill = Waktu DL1 DL2 DL3 D1 D2 D3 D4 D5 D6 Mt/noint;`

except for the y-variable BILL must be present (not missing). Then you can get predicted values from the output statement.

`output out = Res R = Bill_Res p=bill_pred;`

--

Paige Miller

Paige Miller

19 REPLIES 19

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

@sasgiaz wrote:

Hello again. I would like to do forecast with regression model.

I use this source code but the result won't come out and I don't know what could be wrong.

We need a lot more information than just saying that the results don't come out.

Please be specific and detailed.

Show us the SAS LOG (Click on the {i} icon and paste the log into that window DO NOT SKIP THIS STEP)

Show us the results where you don't see what you want to see.

--

Paige Miller

Paige Miller

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

It says like this

NOTE: The previous statement has been deleted.

132 *Peramalan;

133 forecast out = ramalan lead = 12;

--------

180

ERROR 180-322: Statement is not valid or it is used out of proper order.

134 run;

WARNING: RUN statement ignored due to previous errors. Submit QUIT; to terminate the procedure.

NOTE: The SAS System stopped processing this step because of errors.

WARNING: The data set WORK.RES may be incomplete. When this step was stopped there were 36

observations and 14 variables.

WARNING: Data set WORK.RES was not replaced because this step was stopped.

NOTE: PROCEDURE REG used (Total process time):

real time 17.98 seconds

cpu time 2.07 seconds

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

**Click on the {i} icon and paste the log into that window DO NOT SKIP THIS STEP**

Don't just show us the errors, we need to see the entire LOG for this PROC.

--

Paige Miller

Paige Miller

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

Sure, is this explain enough?

161 proc reg data = armaxvlp;

162 model Bill = Waktu DL1 DL2 DL3 D1 D2 D3 D4 D5 D6 Mt/influence;

163 output out = Res R = Bill_Res;

164 run;

165 *Pemodelan ARMAX Variasi Liburan dan Perdagangan Trend Deterministik Tanpa Variabel

165! Konstan;

NOTE: The data set WORK.RES has 36 observations and 14 variables.

NOTE: PROCEDURE REG used (Total process time):

real time 2.15 seconds

cpu time 0.53 seconds

166 proc reg data = armaxvlp;

167 model Bill = Waktu DL1 DL2 DL3 D1 D2 D3 D4 D5 D6 Mt/noint;

168 output out = Res R = Bill_Res;

169 run;

170 *Peramalan;

171 forecast out = ramalan lead = 12;

--------

180

NOTE: The previous statement has been deleted.

ERROR 180-322: Statement is not valid or it is used out of proper order.

172 run;

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

We're trying to help you, but you have to help us. Click on the {i} icon and paste the log into that window.

--

Paige Miller

Paige Miller

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

I can not find the {i} icon

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

It is in the icon bar immediately above where you type your messages, sixth from the left.

--

Paige Miller

Paige Miller

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

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

Thanks.

There is no FORECAST statement in PROC REG. So, the FORECAST statement doesn't execute and produce an output data set. When you put a RUN; statement in PROC REG, it executes the command, but does not end PROC REG. You need a QUIT; statement to end PROC REG, it should go immediately after the RUN; statement.

If you want to do a time series forecast, there are other tools that can do this (one is PROC ARIMA), or you can have PROC REG do a very crude forecast, for example if you had data from 1980 to 2018, and the year is a term in the model, you could have a crude forecast from PROC REG for 2019, but I don't see how that would fit here, as you don't seem to have a time variable in your model.

--

Paige Miller

Paige Miller

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

I have the time variable which I named it as "Waktu". If that so, I still can have the forecast from the proc reg?

Because, actually I use the regression analysis on my time series data to analyze holiday and trading day variation.

So I got the regression model as its best fit and want to do the forecast for at least a year.

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

For the record, the data I have is from 2016 to 2018, monthly.

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

If you are fitting a regression on a monthly data set, from 2016 to 2018, and now you want forecasts for 2019, you can get predicted values for 2019 but you need to have all the values of the x-variables in the regression present, plus Waktu must be months in 2019.

In other words, all the variables in

`model Bill = Waktu DL1 DL2 DL3 D1 D2 D3 D4 D5 D6 Mt/noint;`

except for the y-variable BILL must be present (not missing). Then you can get predicted values from the output statement.

`output out = Res R = Bill_Res p=bill_pred;`

--

Paige Miller

Paige Miller

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

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

@sasgiaz wrote:

I don't know what you mean. Explain further.

--

Paige Miller

Paige Miller

**Available on demand!**

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

Upcoming Events

- RTSUG Webinar: Intro to Coding in SAS Viya | 20-Jun-2024
- SAS® Viya® Workbench – Available on AWS Marketplace | 25-Jun-2024
- DCSUG Virtual Meeting with Kirk Paul Lafler | 26-Jun-2024
- Ask the Expert: How Can I Use SAS® Optimization From Python? | 09-Jul-2024
- WUSS Virtual: Mastering Oncology Studies: A Comprehensive Guide for Programmers & Biostatisticians | 12-Jul-2024
- Ask the Expert: Jupyter Notebook: Your Coding Canvas | 16-Jul-2024
- MinnSUG Annual SAS Conference | 17-Jul-2024

Mastering the WHERE Clause in PROC SQL

SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.

Find more tutorials on the SAS Users YouTube channel.