SHAZAM Converting to Different Periodicities

## Converting Time Series Data to Different Periodicities

Statistical agencies may report time series data on a monthly basis. This data can be converted to quarterly data or annual data by using a suitable conversion method. For example, a monthly price index can be converted to a quarterly price index by computing 3-month averages. Monthly data on the volume of retail sales can be converted to quarterly or annual data by summation.

With SHAZAM, the `SUM` function on the `GENR` command can be used to convert time series data to different periodicities. The command format is:

 `GENR newvar=SUM(var,n)`

The `SUM` function sums up `n` successive observations on the variable `var` starting at observation 1.

#### Example

Suppose monthly data for variable `VARM` is available for the sample period 1986M1 to 1996M12 (132 monthly observations). The SHAZAM commands below convert the data to quarterly data by using 3-month averages.

 ```SAMPLE 1 132 READ (file) DATEM VARM * Set the sample to the number of quarterly observations SAMPLE 1 44 * Convert to quarterly data by computing monthly averages GENR VARQ=SUM(VARM,3)/3 * Generate a quarterly date variable starting in 1986Q1 TIME 1986 4 DATEQ * Write the results to a data file WRITE (newfile) DATEQ VARQ STOP ```

The `WRITE` command is used to save the new data to a data file.

[SHAZAM Guide home]