Working with Time Series Data

Storing Time Series in a SAS Data Set

This section discusses aspects of storing time series in SAS data sets. The topics discussed are the standard form of a time series data set, storing several series with different time ranges in the same data set, omitted observations, cross-sectional dimensions and BY groups, and interleaved time series.

Any number of time series can be stored in a SAS data set. Normally, each time series is stored in a separate variable. For example, the following statements augment the USCPI data set read in the previous example with values for the producer price index (PPI):

data usprice;
   input date : monyy7. cpi ppi;
   format date monyy7.;
   label cpi = "Consumer Price Index"
         ppi = "Producer Price Index";
datalines;
jun1990 129.9 114.3
jul1990 130.4 114.5
aug1990 131.6 116.5

   ... more lines ...   

proc print data=usprice;
run;

Figure 3.4: Time Series Data Set Containing Two Series

Obsdatecpippi
1JUN1990129.9114.3
2JUL1990130.4114.5
3AUG1990131.6116.5
4SEP1990132.7118.4
5OCT1990133.5120.8
6NOV1990133.8120.1
7DEC1990133.8118.7
8JAN1991134.6119.0
9FEB1991134.8117.2
10MAR1991135.0116.2
11APR1991135.2116.0
12MAY1991135.6116.5
13JUN1991136.0116.3
14JUL1991136.2116.0