Previous Page | Next Page

The EXPAND Procedure

Combining Time Series with Different Frequencies

One important use of PROC EXPAND is to combine time series measured at different sampling frequencies. For example, suppose you have data on monthly money stocks (M1), quarterly gross domestic product (GDP), and weekly interest rates (INTEREST), and you want to perform an analysis of a model that uses all these variables. To perform the analysis, you first need to convert the series to a common frequency and then combine the variables into one data set.

The following statements illustrate this process for the three data sets QUARTER, MONTHLY, and WEEKLY. The data sets QUARTER and WEEKLY are converted to monthly frequency using two PROC EXPAND steps, and the three data sets are then merged using a DATA step MERGE statement to produce the data set COMBINED. The quarterly GDP data are interpolated as the total GDP over each month (OBSERVED=TOTAL) while the weekly INTEREST data are converted to average rates over each month (OBSERVED=AVERAGE).

   proc expand data=quarter out=temp1 
               from=qtr to=month;
      id date;
      convert gdp / observed=total;
   run;

   proc expand data=weekly out=temp2 
               from=week to=month;
      id date;
      convert interest / observed=average;
   run;

   data combined;
      merge monthly temp1 temp2;
      by date;
   run;

See Chapter 3, Working with Time Series Data, for further discussion of time series periodicity, time series dating, and time series interpolation. See the section Specifying Observation Characteristics for more information on the OBSERVED= option.

Previous Page | Next Page | Top of Page