Example 9.11 Creating SAS Datetime Values and Computing the Difference between Two Datetime Values
Goal
Create a new variable that contains a SAS datetime value by combining SAS date values and SAS time values. Compute the difference in hours between two datetime values.
Example Features
Featured Step | DATA step |
Featured Step Options and Statements | DHMS, INTCK, and MDY functions |
Input Data Set
Data set OCT2009_ORDERS contains order placement and shipment information about eight orders. The orders were placed in October 2009, and only the day of the month was recorded. The shipment date and shipment hour were recorded.
OCT2009_ORDERS order_ order_ ship_ Obs customerid orderid day time ship_date hour 1 XXV0NW C10761 22 23:04 10/24/2009 7 2 5MY0CJ ...
Get Combining and Modifying SAS® Data Sets: Examples Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.