O'Reilly logo

Combining and Modifying SAS® Data Sets: Examples Second Edition by Michele M. Burlew

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 StepDATA step
Featured Step Options and StatementsDHMS, 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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required