Forecasting using SAS Forecast Server, SAS/ETS, and more

Graphical Results in Unobserved Components Model

Accepted Solution Solved
Reply
Contributor
Posts: 24
Accepted Solution

Graphical Results in Unobserved Components Model

I am running the Unobserved Components Model. I generate graphical results for forecasts. Is there any command which can help me to change the colour of the confidence intervals for the forecasts (which is blue by default)?

 

 

 

 


Accepted Solutions
Solution
‎06-21-2016 08:56 AM
SAS Employee
Posts: 416

Re: Graphical Results in Unobserved Components Model

Posted in reply to jaweriahh

Hello -

Here are a couple of thoughts:

a) SAS Studio allows you to set default styles in a dialog - rather than using code. See: http://support.sas.com/documentation/cdl/en/webeditorug/68254/HTML/default/viewer.htm#p04pw81m36jmgy.... You may be able to specify the style you want using the dialog and remove all ODS related statements from your code again.

b) If a) is not working, this could also be related to lack of write access rights - in this case you may be able to add a gpath option to your code, see: http://support.sas.com/documentation/cdl/en/graphref/67881/HTML/default/viewer.htm#n09h3f7dy6lxzcn13...

c) if a) and b) are failing - I'd suggest to reach out to Technical Support for a more thorough analysis of the issue you are running into.

 

Finally I'm wondering about your last data step:

data results;

set results;

passf = exp(forecast + 0.5*std**2);

passlcl = exp(lcl);

passucl = exp(ucl);

if _n_ > 55;

keep obs forecast std lcl ucl passf passlcl passucl;

run;

which seems to result in data set with 0 observations.

You may want to try:

data results;

set results;

if ^missing(forecast) then do;

passf = exp(forecast + 0.5*std**2);

passlcl = exp(lcl);

passucl = exp(ucl);

end;

keep obs forecast std lcl ucl passf passlcl passucl;

run;

instead.

Thanks,

Udo

View solution in original post


All Replies
Respected Advisor
Posts: 4,932

Re: Graphical Results in Unobserved Components Model

Posted in reply to jaweriahh

Change the style associated with your ODS destination. If your destination is HTML, the default style is HTMLBLUE. Change it with

 

ODS HTML style=Statistical;

 

or 

 

ODS HTML style=Journal;

 

Another option is to create your own graphics from proc UCM output with SGPLOT.

PG
Contributor
Posts: 24

Re: Graphical Results in Unobserved Components Model

Thank you for your answer. I require the journal option but do not know how to include it in my SAS code. The code that I am using is.

 

 

proc ucm data = metals;
id year interval = year;
model logtin=level1986;
irregular;
level variance=0 noest;
slope plot=smooth;
cycle plot=smooth;
cycle plot=smooth;
estimate plot=acf plot=cusum plot=cusumsq plot=histogram plot=loess plot=pacf plot=model plot=qq plot=wn back=5;
forecast back=5 lead=5 plot=decomp;
run;

 

If I specify the option ODS HTML style=journal before proc ucm I get an error. Please advise

SAS Employee
Posts: 416

Re: Graphical Results in Unobserved Components Model

Posted in reply to jaweriahh

Hello -

http://support.sas.com/documentation/cdl/en/statug/68162/HTML/default/viewer.htm#statug_odsgraph_toc... might be useful.

If you can share the error message you see, we may be able to provide some more guidance.

Thanks,

Udo

Contributor
Posts: 24

Re: Graphical Results in Unobserved Components Model

 

The code that I use is 

 

data metals;	
input METAL_INDICES @@;
year = intnx( 'year', '1jan1960'd, _n_-1 );
format year year4.;
datalines;
66.22394646972511
63.384704520079
61.4419993429769
62.9757221934923
73.6304533994784
82.5734655655989
84.1483788908113
73.3390991255459
77.4431122955925
82.4270327336745
78.7169960742791
68.8143144975537
61.8121521989829
69.5780120704402
70.9516888908576
55.8389544132356
59.8840130129157
61.9357151684358
57.7552833219016
65.8560733079746
65.7405466406374
51.88053840411849
45.6068461282871
55.758026125387
51.2150888852897
47.315645402171
41.2951031311713
47.9488331430076
70.4396617071417
64.7588119558383
54.840202297415
47.0899987683978
44.7236678825118
37.2367586934329
46.0601800629501
51.090465430714
44.4227938184707
48.0554952320341
41.090861817545
41.6011233159068
48.0762406145175
44.9000941006041
43.71436526851619
46.26060606160901
57.9601902078588
68.5299063421553
102.220610510998
113.302733959249
99.4066215642484
70.9260523446916
100
104.177006984306
89.34210534803179
85.62180156384051
80.0811093609334
;
RUN;

data metals;
set metals; 
LOGMETALS=log(METAL_INDICES);

data metals;
set metals;
level1988= ( year >= '1jan1988'd );
run;

ODS HTML style=Journal;
proc ucm data = metals;
id year interval = year;
model LOGMETALS=level1988;
irregular;
leveL variance=0 noest;
slope plot=smooth;
cycle plot=smooth;
CYCLE plot=smooth;
estimate plot=acf plot=cusum plot=cusumsq plot=histogram plot=loess plot=pacf plot=model plot=qq plot=wn Back=6;
forecast back=6 lead=6 plot=decomp outfor = results;
RUN;

data results;
set results;
passf = exp(forecast + 0.5*std**2);
passlcl = exp(lcl);
passucl = exp(ucl);
if _n_ > 55;
keep obs forecast std lcl ucl passf passlcl passucl;
run;
proc print data = results;
run;








 

And the error that I get is 

 

NOTE: ODS statements in the SAS Studio environment may disable some output features
ODS HTML style=Journal;
NOTE: Writing HTML Body file: sashtml6.htm
ERROR: Insufficient authorization to access /opt/sasinside/SASConfig/Lev1/SASApp/sashtml6.htm.
ERROR: No body file. HTML output will not be created.
 
 
Solution
‎06-21-2016 08:56 AM
SAS Employee
Posts: 416

Re: Graphical Results in Unobserved Components Model

Posted in reply to jaweriahh

Hello -

Here are a couple of thoughts:

a) SAS Studio allows you to set default styles in a dialog - rather than using code. See: http://support.sas.com/documentation/cdl/en/webeditorug/68254/HTML/default/viewer.htm#p04pw81m36jmgy.... You may be able to specify the style you want using the dialog and remove all ODS related statements from your code again.

b) If a) is not working, this could also be related to lack of write access rights - in this case you may be able to add a gpath option to your code, see: http://support.sas.com/documentation/cdl/en/graphref/67881/HTML/default/viewer.htm#n09h3f7dy6lxzcn13...

c) if a) and b) are failing - I'd suggest to reach out to Technical Support for a more thorough analysis of the issue you are running into.

 

Finally I'm wondering about your last data step:

data results;

set results;

passf = exp(forecast + 0.5*std**2);

passlcl = exp(lcl);

passucl = exp(ucl);

if _n_ > 55;

keep obs forecast std lcl ucl passf passlcl passucl;

run;

which seems to result in data set with 0 observations.

You may want to try:

data results;

set results;

if ^missing(forecast) then do;

passf = exp(forecast + 0.5*std**2);

passlcl = exp(lcl);

passucl = exp(ucl);

end;

keep obs forecast std lcl ucl passf passlcl passucl;

run;

instead.

Thanks,

Udo

Contributor
Posts: 24

Re: Graphical Results in Unobserved Components Model

Thank you I was able to change the preference and get the journal format.

☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 6 replies
  • 599 views
  • 0 likes
  • 3 in conversation