Resources

Forecasting Auto Sales

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

                    SAS Sample Library

        Name: forex01.sas
 Description: Example program from SAS/ETS User's Guide,
              The FORECAST Procedure
       Title: Forecasting Auto Sales
     Product: SAS/ETS Software
        Keys: time series forecasting
        PROC: FORECAST
       Notes:

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

title1 "Sales of Passenger Cars";

symbol1 i=spline v=dot;
axis2 label=(a=-90 r=90 "Vehicles and Parts" )
      order=(6000 to 24000 by 3000);

title1 "Sales of Passenger Cars";
proc sgplot data=sashelp.usecon;
   series x=date y=vehicles / markers;
   xaxis values=('1jan80'd to '1jan92'd by year);
   yaxis values=(6000 to 24000 by 3000);
   format date year4.;
run;

proc forecast data=sashelp.usecon interval=month
              method=winters seasons=month lead=12
              out=out outfull outresid outest=est;
   id date;
   var vehicles;
   where date >= '1jan80'd;
run;

title2 'The OUT= Data Set';
proc print data=out (obs=20) noobs;
run;

title2 'The OUTEST= Data Set: WINTERS Method';
proc print data=est;
run;

title1 "Sales of Passenger Cars";
title2 'Plot of Residuals';
proc sgplot data=out;
   where _type_ = 'RESIDUAL';
   needle x=date y=vehicles / markers markerattrs=(symbol=circlefilled);
   xaxis values=('1jan80'd to '1jan92'd by year);
   format date year4.;
run;

title1 "Sales of Passenger Cars";
title2 'Plot of Forecast from WINTERS Method';
proc sgplot data=out;
   series x=date y=vehicles / group=_type_ lineattrs=(pattern=1);
   where _type_ ^= 'RESIDUAL';
   refline '15dec91'd / axis=x;
   yaxis values=(9000 to 25000 by 1000);
   xaxis values=('1jan90'd to '1jan93'd by qtr);
run;