Hello,
I am trying to automate ARIMA model selection using PROC ARIMA, and I want to output the residual correlation diagnostics (ACF, PACF, IACF, and White Noise Prob for resididuals) into a dataset, but I can't figure out how.
My SAS version is 9.04.01M2P07232014.
Hi,
You can use ODS (Output Delivery System) to output to a SAS data set all of the values used to create each of the plots in this graphics panel produced by PROC ARIMA. In order to do this, you must first determine the name of the ODS graph. To do that, you can add these statements immediately before your PROC ARIMA step:
ods listing;
ods trace on / listing;
The ODS LISTING; statement tells SAS to open up the listing destination, and the ODS TRACE ON / LISTING; statement tells SAS to interleave tracing information, including the ODS table and graph names, with the (non-graphical) output generated by the procedure. Even though ODS graphics are not written to the listing destination, the ODS graph names produced by the ODS TRACE ON statement are written to the listing (ie. output) file.
When you include the above statements prior to your PROC ARIMA step and rerun your analysis (making sure you have a QUIT; statement to end your interactive PROC ARIMA step), you will see that the name of the ODS graph of interest to you is ResidualCorrPanel.
Now that you know the name of the ODS graph whose data values you want to output to a data set, you can turn the tracing information off via an ODS TRACE OFF; statement, add an ODS OUTPUT statement to your code, and rerun your PROC ARIMA analysis. The ODS OUTPUT statement in your PROC ARIMA step writes the data used to generate the graph to a SAS data set. The syntax is: ODS OUTPUT graphname=datasetname;
Following, please find an example to illustrate the above steps:
data a;
set sashelp.air;
y=log(air);
run;
ods listing;
ods trace on / listing;
proc arima data=a;
identify var=y(1,12);
estimate q=(1)(12);
run;
quit;
ods trace off;
proc arima data=a;
ods output ResidualCorrPanel=residcorr;
identify var=y(1,12);
estimate q=(1)(12);
run;
quit;
proc print data=residcorr;
run;
For more details on using ODS to output tables (and graphics data) to a SAS data set, please see SAS Usage Note 22949.
Regarding your application, please note that SAS Forecast Server and SAS Forecasting for Desktop offer built-in functionality for automatic model selection of time series models, including univariate ARIMA and transfer function models. The AUTOMDL statement in PROC X12 (X13) might also be helpful for automatic selection of an ARIMA model, but the methodology supported by this procedure is only available for monthly or quarterly time series.
I hope this helps!
DW
Hi,
You can use ODS (Output Delivery System) to output to a SAS data set all of the values used to create each of the plots in this graphics panel produced by PROC ARIMA. In order to do this, you must first determine the name of the ODS graph. To do that, you can add these statements immediately before your PROC ARIMA step:
ods listing;
ods trace on / listing;
The ODS LISTING; statement tells SAS to open up the listing destination, and the ODS TRACE ON / LISTING; statement tells SAS to interleave tracing information, including the ODS table and graph names, with the (non-graphical) output generated by the procedure. Even though ODS graphics are not written to the listing destination, the ODS graph names produced by the ODS TRACE ON statement are written to the listing (ie. output) file.
When you include the above statements prior to your PROC ARIMA step and rerun your analysis (making sure you have a QUIT; statement to end your interactive PROC ARIMA step), you will see that the name of the ODS graph of interest to you is ResidualCorrPanel.
Now that you know the name of the ODS graph whose data values you want to output to a data set, you can turn the tracing information off via an ODS TRACE OFF; statement, add an ODS OUTPUT statement to your code, and rerun your PROC ARIMA analysis. The ODS OUTPUT statement in your PROC ARIMA step writes the data used to generate the graph to a SAS data set. The syntax is: ODS OUTPUT graphname=datasetname;
Following, please find an example to illustrate the above steps:
data a;
set sashelp.air;
y=log(air);
run;
ods listing;
ods trace on / listing;
proc arima data=a;
identify var=y(1,12);
estimate q=(1)(12);
run;
quit;
ods trace off;
proc arima data=a;
ods output ResidualCorrPanel=residcorr;
identify var=y(1,12);
estimate q=(1)(12);
run;
quit;
proc print data=residcorr;
run;
For more details on using ODS to output tables (and graphics data) to a SAS data set, please see SAS Usage Note 22949.
Regarding your application, please note that SAS Forecast Server and SAS Forecasting for Desktop offer built-in functionality for automatic model selection of time series models, including univariate ARIMA and transfer function models. The AUTOMDL statement in PROC X12 (X13) might also be helpful for automatic selection of an ARIMA model, but the methodology supported by this procedure is only available for monthly or quarterly time series.
I hope this helps!
DW
Excellent, that's what I needed.
Thanks,
Stephen
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.