The Airline Series Revisited

/*--------------------------------------------------------------

                    SAS Sample Library

        Name: ucmex01.sas
 Description: Example program from SAS/ETS User's Guide,
              The UCM Procedure
       Title: The Airline Series Revisited
     Product: SAS/ETS Software
        Keys: equally spaced univariate time series data
        PROC: UCM
       Notes:

--------------------------------------------------------------*/

ods graphics on;

data seriesG;
   set sashelp.air;
   logair = log(air);
run;

ods output Forecasts = fortable
   (rename = (actual=logair  time=date)
   where=(date >= '1jan1960'd and date < '1jan1961'd));
ods output EstimationSpan = espan;
ods output ForecastSpan = fspan;

proc ucm data = seriesG;
   id date interval = month;
   model logair;
   irregular;
   level;
   slope var = 0 noest;
   season length = 12 type=trig;
   estimate back=24 plot=panel;
   forecast back=12 lead=24 print=forecasts;
run;

proc print data=espan noobs;
   var variable type first last nobs mean;
run;

proc print data=fspan noobs;
   var variable type first last nobs mean;
run;

proc print data=fortable noobs;
   var obs date forecast stderr logair residual;
   format _numeric_  8.3;
   format date monyy.5;
   format obs 8.0;
run;

proc ucm data = seriesG;
   id date interval = month;
   model logair;
   irregular;
   level;
   slope var = 0 noest;
   season length = 12 type=trig;
   estimate back=24;
   forecast back=12 lead=24 plot=forecasts;
run;