Missing Values and Omitted Observations |
Missing data can also occur within a series. Missing values that appear after the beginning of a time series and before the end of the time series are called embedded missing values.
Suppose that in the preceding example you did not record values for CPI for November 1990 and did not record values for PPI for both November 1990 and March 1991. The USPRICE data set could be read with the following statements:
data usprice; input date : monyy. cpi ppi; format date monyy.; datalines; jun1990 . 114.3 jul1990 . 114.5 aug1990 131.6 116.5 sep1990 132.7 118.4 oct1990 133.5 120.8 nov1990 . . dec1990 133.8 118.7 jan1991 134.6 119.0 feb1991 134.8 117.2 mar1991 135.0 . apr1991 135.2 116.0 may1991 135.6 116.5 jun1991 136.0 116.3 jul1991 136.2 . ;
In this example, the series CPI has one embedded missing value, and the series PPI has two embedded missing values. The ranges of the two series are the same as before.
Note that the observation for November 1990 has missing values for both CPI and PPI; there is no data for this period. This is an example of a missing observation.
You might ask why the data record for this period is included in the example at all, since the data record contains no data. However, deleting the data record for November 1990 from the example would cause an omitted observation in the USPRICE data set. SAS/ETS procedures expect input data sets to contain observations for a contiguous time sequence. If you omit observations from a time series data set and then try to analyze the data set with SAS/ETS procedures, the omitted observations will cause errors. When all data are missing for a period, a missing observation should be included in the data set to preserve the time sequence of the series.
If observations are omitted from the data set, the EXPAND procedure can be used to fill in the gaps with missing values (or to interpolate nonmissing values) for the time series variables and with the appropriate date or datetime values for the ID variable.