Chapter Contents
Chapter Contents
Creating Time ID Variables

Creating a Time ID from Other Dating Variables

Your data set may contain ID variables that date the observations in a different way than the SAS date valued ID variable expected by the forecasting system. For example, for monthly data the data set may contain the ID variables YEAR and MONTH, which together date the observations.

In these cases, you can use the Forecasting system's Create Time ID features to compute a time ID variable with SAS date values from the existing dating variables. As an example of this, you will use the SAS data set read in by the following SAS statements.

data id_parts;
  input yr qtr y;
 91 1 10
 91 2 15
 91 3 20
 91 4 25
 92 1 30
 92 2 35
 92 3 40
 92 4 45
 93 1 50
 93 2 55
 93 3 60
 93 4 65
 94 1 70
 94 2 75
 94 3 80
 94 4 85

Submit these SAS statements to create the data set ID_PARTS. This data set contains the three variables YR, QTR, and Y. YR and QTR are ID variables that together date the observations, but each variable provides only part of the date information. Because the forecasting system requires a single dating variable containing SAS date values, you need to combine YR and QTR to create a single variable DATE.

Type ID_PARTS in the Data Set field and press the enter key. (You could also use the Browse button to bring up the Data Set Selection window as in the previous example, and complete this example from there.)

Select the Create button at the right of the Time ID field. This brings up the menu of Create Time ID choices, as shown in Display 24.8.

Display 24.8: Adding a Time ID Variable
tfid08.gif (114353 bytes)

Select the second choice, Create from existing variables. This brings up the window shown in Display 24.9.

Display 24.9: Creating a Time ID Variable from Date Parts
tfid09.gif (110273 bytes)

In the Variables list, select YR. In the Date Part list, select YEAR as shown in Display 24.10.

Display 24.10: Specifying the ID Variable for Years
tfid10.gif (108273 bytes)

Now click the right-pointing arrow button. The variable YR and the part code YEAR are added to the Existing Time IDs list.

Now select QTR from the Variables list and select QTR from the Date Part list, and click the arrow button. This adds the variable QTR and the part code QTR to the Existing Time IDs list, as shown in Display 24.11.

Display 24.11: Creating a Time ID Variable from Date Parts
tfid11.gif (108090 bytes)

Now select the OK button. This brings up the New Data Set Name window. Change the New data set name field to NEWDATE, and then select the OK button.

The data set NEWDATE is created, and the system returns to the Time Series Forecasting window with NEWDATE as the selected Data Set. The Time ID field is set to DATE, and the Interval field is set to QTR.

Chapter Contents
Chapter Contents

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.