Working with Time Series Data


Dating Observations

The SAS System supports special date, datetime, and time values, which make it easy to represent dates, perform calendar calculations, and identify the time period of observations in a data set.

The preceding example uses the ID variables YEAR and MONTH to identify the time periods of the observations. For a quarterly data set, you might use YEAR and QTR as ID variables. A daily data set might have the ID variables YEAR, MONTH, and DAY. Clearly, it would be more convenient to have a single ID variable that could be used to identify the time period of observations, regardless of their frequency.

The following section, SAS Date, Datetime, and Time Values, discusses how the SAS System represents dates and times internally and how to specify date, datetime, and time values in a SAS program. The section Reading Date and Datetime Values with Informats discusses how to read in date and time values from data records and how to control the display of date and datetime values in SAS output. Later sections discuss other issues concerning date and datetime values, specifying time intervals, data periodicity, and calendar calculations.

SAS date and datetime values and the other features discussed in the following sections are also described in SAS Language Reference: Dictionary. Reference documentation on these features is also provided in ChapterĀ 4: Date Intervals, Formats, and Functions.