Timestamped Transactional Analysis

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

                    SAS Sample Library

        Name: tseex01.sas
 Description: Example program from SAS/ETS User's Guide,
              The TIMESERIES Procedure
       Title: Timestamped Transactional Analysis
     Product: SAS/ETS Software
        Keys: time-stamped transactional data
        PROC: TIMESERIES
       Notes:

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

data retail;
    length store $ 10;
    format timestamp date.;

    array loc[4] $ loc1-loc4 ("Alamance" "Durham" "Orange" "Wake");
    array item[8] item1-item8;

    keep store timestamp item1-item8;

    call streaminit(1);
    do i = 1 to 4;
      store = loc[i];
      timestamp = '1nov1998'd;
      do j = 1 to 100;
         dt = floor(30*rand('uniform'));
         timestamp = intnx('day',timestamp,dt);
         do k = 1 to 8;
            item[k] = rand('normal');
         end;
         output;
      end;

   end;
run;

proc timeseries data=retail out=mseries;
   by store;
   id timestamp interval=month
                accumulate=median
                setmiss=0
                start='01jan1998'd
                end  ='31dec2000'd;
   var item1-item8;
run;