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:

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

   ... more lines ...   

proc print data=usprice;
run;

Figure 3.4 Time Series Data Set Containing Two Series
Obs date cpi ppi
1 JUN1990 129.9 114.3
2 JUL1990 130.4 114.5
3 AUG1990 131.6 116.5
4 SEP1990 132.7 118.4
5 OCT1990 133.5 120.8
6 NOV1990 133.8 120.1
7 DEC1990 133.8 118.7
8 JAN1991 134.6 119.0
9 FEB1991 134.8 117.2
10 MAR1991 135.0 116.2
11 APR1991 135.2 116.0
12 MAY1991 135.6 116.5
13 JUN1991 136.0 116.3
14 JUL1991 136.2 116.0