Previous Page | Next Page

Working with Time Series Data

Filling In Omitted Observations in a Time Series Data Set

Most SAS/ETS procedures expect input data to be in the standard form, with no omitted observations in the sequence of time periods. When data are missing for a time period, the data set should contain a missing observation, in which all variables except the ID variables have missing values.

You can replace omitted observations in a time series data set with missing observations with the EXPAND procedure.

The following statements create a monthly data set, OMITTED, from data lines that contain records for an intermittent sample of months. (Data values are not shown.) The OMITTED data set is sorted to make sure it is in time order.

   data omitted;
      input date : monyy7. x y z;
      format date monyy7.;
   jan1991  ...
   mar1991  ...
   apr1991  ...
   jun1991  ...
    ... etc. ...

   proc sort data=omitted;
      by date;

This data set is converted to a standard form time series data set by the following PROC EXPAND step. The TO= option specifies that monthly data is to be output, while the METHOD=NONE option specifies that no interpolation is to be performed, so that the variables X, Y, and Z in the output data set STANDARD will have missing values for the omitted time periods that are filled in by the EXPAND procedure.

   proc expand data=omitted
      id date;
Previous Page | Next Page | Top of Page