Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Working with Time Series Data

Computing Datetime Values

To compute datetime ID values from calendar and time variables, first compute the date and then compute the datetime with DHMS.

For example, suppose you read tri-hourly temperature data with time recorded as YEAR, MONTH, DAY, and HOUR. The following statements show how to compute the ID variable DATETIME:

   data weather;
      input year month day hour temp;
      datetime = dhms( mdy( month, day, year ), hour, 0, 0 );
      format datetime datetime10.;
   datalines;
   91 10 16 21  61
   91 10 17  0  56
   91 10 17  3  53
   91 10 17  6  54
   91 10 17  9  65
   91 10 17 12  72
    ... etc. ...
   ;

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

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