Use of AUXDATA with PROC TIMEDATA

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

                    SAS Sample Library

        Name: tdtex03.sas
 Description: Example program from SAS/ETS User's Guide,
              The TIMEDATA Procedure
       Title: Use of AUXDATA with PROC TIMEDATA
     Product: SAS/ETS Software
        Keys: AUXDATA
        PROC: TIMEDATA
       Notes:

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


proc timeseries data=sashelp.gulfoil
                out=byregion(rename=(oil=roil gas=rgas));
   by regionname;
   id date interval=month accumulate=total notsorted;
   var oil gas;
run;

proc timedata data=sashelp.gulfoil
              auxdata=byregion
              out=_null_
              outarray=shares;
   by regionname protractionname;
   outarray oilshare gasshare;
   var oil gas roil rgas;
   id date interval=month accumulate=total;
   do i=1 to _length_;
      oilshare[i] = oil[i] / roil[i];
      gasshare[i] = gas[i] / rgas[i];
   end;
run;

proc timeseries data=shares
                out=rshares(rename=(oilshare=oilsum gasshare=gassum));
   by regionname;
   id date interval=month accumulate=total notsorted;
   var oilshare gasshare;
run;
proc means data=rshares;
   by regionname;
   var oilsum gassum;
run;

proc sgplot data=shares(where=(RegionName='Western'));
   series x=Date y=OilShare/group=ProtractionName;
run;