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
- /
- Re: PROC ARIMA with Input Variable

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**.
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 11-08-2021 11:34 PM
(697 views)

I am trying to implement a forecasting model from SAS Viya in SAS code. Below is the screenshot of the Viya model:

here is what I put in sas code

```
PROC ARIMA DATA=AP.GR_DEG_FORECAST;
IDENTIFY VAR=Graduate_Count(1);
ESTIMATE p=1 METHOD=ML; /*forecast input series*/
IDENTIFY VAR=Doctoral_degrees(1) CROSSCORR=Graduate_Count(1) NOPRINT;
ESTIMATE NOINT INPUT=(1 $ (1)Graduate_Count/(2)Graduate_Count) METHOD=ML;
FORECAST ID=AY INTERVAL=YEAR LEAD=6 ALPHA=0.05 OUT=PREJ_DOC_DEG_FORECAST PRINTALL /* print the FORECAST computation throughout the whole data set*/;
RUN;
```

Title "Forecast: PRE#J: Doctoral Degrees Awarded Annually";

PROC SGPLOT DATA=PREJ_DOC_DEG_Forecast;

BAND Upper=u95 Lower=l95 x=AY / Legendlabel="95% Confidence Limits";

scatter x=AY y=Doctoral_degrees;

series x=AY y=forecast;

refline "01JAN2022"d / axis=x lineattrs=(thickness=1 color=BLUE pattern=dash);

RUN;

Title;

However, I got very different results by running the sas code. And the model does not seem to catch the data series as it would in Viya. I am not sure which step of the code is wrong. Can anyone help me? Here is a screenshot of the forecast from sas code:

1 ACCEPTED SOLUTION

Accepted Solutions

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

Hello @xliu1 ,

I looked at :

Forecasting is a Snap in SAS Visual Analytics 8.2 on SAS Viya 3.3

Posted 04-25-2018 09:42 PM | by @BethEbersole

... and I do not think you can see the forecasting-code used in the back-end.

It will not be PROC ARIMA. I am sure about that! It will rather be the HPF-procedures from Forecast Server (HPF = High-Performance Forecasting) or PROC TSMODEL as used in Visual Forecasting.

But anyway, it's not because PROC ARIMA was not used that you are not able to reproduce the forecasts in PROC ARIMA of course.

You can try a different estimation method (METHOD=CLS | ML | ULS)

, but that should not make a super-big difference.

I don not see the "error" in your PROC ARIMA at this moment.

Kind regards,

Koen

6 REPLIES 6

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

Hello,

That seems a very weird result to me (and a very bad fit).

Are you sure you are specifying the exact same model as given by Visual Forecasting?

Also, the syntax in your input= may be wrong.

You specify Graduate_Count for the numerator and again for the denominator of the transfer function.

Specifying it once should be enough, like in :

`input=(1 $ (1)/(2)x)`

Cheers,

Koen

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

@sbxkoenk Thanks for your response! I also realized that typo, and removed Graduate_Count from the numerator. However, I still get very strange results. I am learning forecasting with input variables, and Viya model can help me better understand how to set up parameters. Here is the graph I get from running the sas code. I am not sure which part of the code does not match with Viya model or if the Viya forecasting uses different calculation methods?

```
PROC ARIMA DATA=AP.GR_DEG_FORECAST;
IDENTIFY VAR=Graduate_Count(1);
ESTIMATE p=1 METHOD=ML; /*forecast input series*/
IDENTIFY VAR=Doctoral_degrees(1) CROSSCORR=Graduate_Count(1) NOPRINT;
ESTIMATE NOINT INPUT=(1 $ (1)/(2)Graduate_Count) METHOD=ML;
FORECAST ID=AY INTERVAL=YEAR LEAD=6 ALPHA=0.05 OUT=PREJ_DOC_DEG_FORECAST PRINTALL /* print the FORECAST computation throughout the whole data set*/;
RUN;
/* Plot forecast for PRE#J: Doctoral Degrees Awarded Annually */
Title "Forecast: PRE#J: Doctoral Degrees Awarded Annually";
PROC SGPLOT DATA=PREJ_DOC_DEG_Forecast;
BAND Upper=u95 Lower=l95 x=AY / Legendlabel="95% Confidence Limits";
scatter x=AY y=Doctoral_degrees;
series x=AY y=forecast;
refline "01JAN2022"d / axis=x lineattrs=(thickness=1 color=BLUE pattern=dash);
RUN;
Title;
```

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

Hello @xliu1 ,

I am not sure what you mean with "VIYA Forecasting".

Are you talking about Visual Forecasting in Model Studio?

Or are you talking about SAS Tasks in SAS Studio V?

Or are you talking about SAS snippets in SAS Studio V?

I think you use Visual Forecasting (VF).

VF uses PROC TSMODEL to do the forecasting.

Have a look at the generated TSMODEL code to exactly know which model was fit. Right-Mouse-Button (RMB) click on Forecasting node and then select View code (bottom option).

Also : which version of SAS VIYA are you using?

Submit :

`%PUT &=sysvlong4;`

to find out (see log-screen).

Thanks,

Koen

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

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

Hello @xliu1 ,

I looked at :

Forecasting is a Snap in SAS Visual Analytics 8.2 on SAS Viya 3.3

Posted 04-25-2018 09:42 PM | by @BethEbersole

... and I do not think you can see the forecasting-code used in the back-end.

It will not be PROC ARIMA. I am sure about that! It will rather be the HPF-procedures from Forecast Server (HPF = High-Performance Forecasting) or PROC TSMODEL as used in Visual Forecasting.

But anyway, it's not because PROC ARIMA was not used that you are not able to reproduce the forecasts in PROC ARIMA of course.

You can try a different estimation method (METHOD=CLS | ML | ULS)

, but that should not make a super-big difference.

I don not see the "error" in your PROC ARIMA at this moment.

Kind regards,

Koen

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

**Don't miss out on SAS Innovate - Register now for the FREE Livestream!**

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

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.