Hi,
i want to save forecats when using proc x13 arima.
html output displays them, but i cann't find how to actually save them to a dataset.
i can only find a way to save these components of the forecast: A6, A7, A8, A9, A10, B1, D10, D10B, D10D, D16, D16B, D18,E18- but it's not enough.
how can i save the actual final forecasts?
here's a reproducible example:
this works but i dont get any forecasts:
data WORK.JOIN_2_v1;
set sashelp.air;
series_code = "L_R";
obs_dt = intnx('month', '01JAN1949'd, _N_-1);
OBS_VALUE = air;
format obs_dt date9.;
run;
proc x13 data = WORK.JOIN_2_v1(where= (series_code = "L_R" and obs_dt ge '01JAN1949'd))
date = obs_dt;
var OBS_VALUE;
transform function = NONE;
regression predefined = lom;
arima model = ( (0 1 1)(0 1 1));
forecast lead=12;
estimate MAXITER=1501;
outlier aocv = 3.64 TYPE = AO;
x11 trendma = 13;
output OUT = x13 d11;
id series_code;
run;
i tried many AI suggestion such as:
/*1- output OUT = x13 forecast=forecast_data;*/
/*2- forecast lead=12 outfcst==forecast_data; */
/*3- forecast lead=12 out=forecast_data; */
none worked.
Hi,
Thanks for your help.
I found a solution to compute the forecasts without using ods output.
I use B1 and D18 (sum or multiply depending on the transforamtion used) to re-create the forecast using forecast &output statments .
This is issue can be seen as closed. Thanks again.
Instead of using AI, check the documentation! https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/etsug/etsug_x13_toc.htm
I think you want to add options to the FORECAST statement, as shown here: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.4/etsug/etsug_x13_syntax10.htm
.
Thanks
Hi ,
Thanks for the previous response.
I'll try to clarify my questions regarding exporting forecasts from X-13ARIMA-SEATS to a SAS table. I have read the manual's FORECAST statement (and the output statement) carefully, and as mentioned earlier, it seems like it can only export these tables: A6, A7, A8, A9, A10, B1, D10, D10B, D10D, D16, D16B, D18, and E18. I would anticipate the option to export the forecasts to a SAS table would be available directly. However, I haven't found it (yet...).
Here is the code I am using:
/* Input data */
data WORK.have;
set sashelp.air;
series_code = "L_R";
obs_dt = intnx('month', '01JAN1949'd, _N_-1);
OBS_VALUE = air;
format obs_dt date9.;
run;
/* Seasonal adjustment */
proc x13 data = WORK.have(where= (series_code = "L_R" and obs_dt ge '01JAN1949'd)) date = obs_dt;
var OBS_VALUE;
transform function = NONE;
regression predefined = lom;
arima model = ( (0 1 1)(0 1 1));
forecast lead=12 outfcst;
estimate MAXITER=1501;
outlier aocv = 3.64 TYPE = AO;
x11 trendma = 13;
output OUT = x13 a1 d10 d11;
id series_code;
run;
data want;
/* Forecasts come from the HTML file produced by x13 */
infile cards dlm=' ' dsd truncover;
input obs_dt :monyy7. forecast :best8.2;
format obs_dt monyy7. forecast best8.2;
cards;
JAN1961 446.097
FEB1961 415.65
MAR1961 489.378
APR1961 489.277
MAY1961 501.268
JUN1961 563.504
JUL1961 649.473
AUG1961 635.676
SEP1961 537.826
OCT1961 490.162
NOV1961 421.249
DEC1961 463.227
;
run;
As suggested, I tried adding ods output
like so:
ods output ForecastCL= wanted_ods;
proc x13 data = WORK.have(where= (series_code = "L_R" and obs_dt ge '01JAN1949'd))
date = obs_dt noprint;
var OBS_VALUE;
transform function = NONE;
regression predefined = lom;
arima model = ( (0 1 1)(0 1 1));
forecast lead=12 outfcst;
estimate MAXITER=1501;
outlier aocv = 3.64 TYPE = AO;
x11 trendma = 13;
output OUT = x13 a1 b1 d10 d11;
id series_code;
/* ods output ForecastCL= wanted_ods; *//* It'll work here too */
run;
However, in the production environment, I am forced by IT to add NOPRINT
to avoid creating HTML output. When I add NOPRINT
, the wanted_ods
is not being created, and I'm back at the starting point.
Is there a way to directly export the forecast values to a SAS table without generating HTML output? Any help or suggestions would be greatly appreciated.
Thank you!
From the documentation
OUTFCST
OUTFORECAST
determines whether forecasts are included in certain tables sent to the output data set. If OUTFORECAST is specified, then forecast values are included in the output data set for Tables A6, A7, A8, A9, A10, B1, D10, D10B, D10D, D16, D16B, D18, and E18. The default is not to include forecasts. The OUTFORECAST option can be specified in either the X11 statement or the FORECAST statement with identical results.
You don't have to send output to HTML, you can send output to a text file and then the ODS TRACE and ODS OUTPUT should work fine.
Hi,
Thanks for your reply. As mentioned, I have read the forecast statement manual carefully, but the list of available forecast's components does not include the actual forecasts. Please see the difference between the want_ods table and the output I get from x13_suggested.
(The ODS solution doesn't work in the production environment because it must create an HTML file, and that's blocked in production by IT).
data WORK.have;
set sashelp.air;
series_code = "L_R";
obs_dt = intnx('month', '01JAN1949'd, _N_-1);
OBS_VALUE = air;
format obs_dt date9.;
run;
ods output ForecastCL=want_ods (keep=date forecast);
proc x13 data=WORK.have(where=(series_code = "L_R" and obs_dt ge '01JAN1949'd))
date=obs_dt /*noprint*/;
var OBS_VALUE;
transform function=NONE;
regression predefined=lom;
arima model=((0 1 1)(0 1 1));
forecast lead=12 outfcst;
estimate MAXITER=1501;
outlier aocv=3.64 TYPE=AO;
x11 trendma=13;
/*outputting ALL available options*/
output OUT=x13_suggested1 A6 A7 A8 A9
A10 B1 D10 D10B D10D D16 D16B D18 e18;
id series_code;
/* ods output ForecastCL=ForecastCLData;*/
run;
data x13_suggested;
retain obs_dt ch_is_forecast;
set x13_suggested1 (where=(obs_dt >= mdy(1, 1, 1961)));
keep obs_dt
/*ch_is_forecast*/
obs_value_A6
obs_value_A7
obs_value_A8
obs_value_A9
obs_value_A10
obs_value_B1
obs_value_D10
obs_value_D10B
obs_value_D10D
obs_value_D16
obs_value_D16B
obs_value_D18
obs_value_e18;
/*ch_is_forecast=sum(obs_value_B1,obs_value_D18);*/
run;
P.S. (I must add that at first, I tried adding up the following components (before even checking if it makes sense):
ch_is_forecast=sum(obs_value_B1, obs_value_D18);, but when using auxdata, this approach doesn't work.
(I could send the code, but I didn't want the message to be too long.)
(The ODS solution doesn't work in the production environment because it must create an HTML file, and that's blocked in production by IT).
Send the output to a text file, and then ODS OUTPUT works fine.
I think the soultion of adding up* components may have worked
I have to check it on real data now.
I'll let you know in about a week.
(*I guess the necessary adjustments must be made in cases of log transformation)
Thanks
@T_AR wrote:
I think the soultion of adding up* components may have worked
No idea what the above is talking about.
You can also send HTML to a dummy file, so that no actual file is created, and the ODS OUTPUT works properly. Example:
filename fake dummy;
ods html file=fake;
proc means data=sashelp.class;
ods output summary=summary;
var height;
run;
ods html close;
Hi,
Thanks for your help.
I found a solution to compute the forecasts without using ods output.
I use B1 and D18 (sum or multiply depending on the transforamtion used) to re-create the forecast using forecast &output statments .
This is issue can be seen as closed. Thanks again.
@T_AR wrote:
Hi,
Thanks for your help.
I found a solution to compute the forecasts without using ods output.
I use B1 and D18 (sum or multiply depending on the transforamtion used) to re-create the forecast using forecast &output statments .
This is issue can be seen as closed. Thanks again.
For anyone else who needs this solution, can you provide more detail and actual code?
Or use ODS TRACE to determine how to get the output into a SAS data set
https://www.lexjansen.com/nesug/nesug07/cc/cc30.pdf
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.