Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Creating Time ID Variables

Creating Time ID Value from a Starting Date and Frequency

As a first example of adding a time ID variable, you will use the SAS data set created by the following statements. (Or use your own data set if you prefer.)

data no_id;
  input y @@;
datalines;
  10 15 20 25 30 35 40 45
  50 55 60 65 70 75 80 85
run;

Submit these SAS statements to create the data set NO_ID. This data set contains the single variable Y. Assume that Y is a quarterly series and starts in the first quarter of 1991.

In the Time Series Forecasting window, use the Browse button to the right of the Data set field to bring up the Data Set Selection window. Select the WORK library and then select the NO_ID data set.

You must create a time ID variable for the data set. Click the Create button to the right of the Time ID field. This brings up a menu of choices for how to create the Time ID variable, as shown in Display 24.1.

Display 24.1: Time ID Creation Popup Menu
tfid01.gif (110434 bytes)

Select the first choice, Create from starting date and frequency. This brings up the Time ID Creation from Starting Date window shown in Display 24.2.

Display 24.2: Time ID Creation from Starting Date Window
tfid02.gif (104579 bytes)

Enter the starting date, 1991:1, in the Starting Date field.

Click the Interval combo box arrow and select QTR from the pop-up menu. The Interval value QTR means that the time interval between successive observations is a quarter of a year; that is, the data frequency is quarterly.

Now select the OK button. The system prompts you for the name of the new data set. If you want to create a new copy of the input data set with the DATE variable added, you should enter a name for the new data set. If you want to replace the NO_ID data set with the new copy containing DATE, just select the OK button without changing the name.

For this example, change the New name field to WITH_ID and select the OK button. The data set WITH_ID is created containing the series Y from NO_ID and the added ID variable DATE. The system returns to the Data Set Selection window, which now appears as shown in Display 24.3.

Display 24.3: Data Set Selection Window after Creating Time ID
tfid03.gif (106276 bytes)

Select the Table button to see the new data set WITH_ID. This brings up a VIEWTABLE window on the data set WITH_ID, as shown in Display 24.4. Select File and Close to close the VIEWTABLE window.

Display 24.4: Viewtable Display of Data Set with Time ID Added
tfid04.gif (87568 bytes)

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

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