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.15 Determining the Number of U.S. Business Days between Two Dates

Goal

Determine the number of business days between two dates. Do not count specific holidays as business days.

Example Features

Featured StepDATA step
Featured Step Options and StatementsHOLIDAY, INTCK, and WEEKDAY functions

Input Data Set

Data set DAY_RANGES has two date variables, DAY1 and DAY2.

           DAY_RANGES

Obs          day1           day2
 1     07/01/2008     07/05/2008
 2     06/23/2008     06/27/2008
 3     05/19/2008     05/19/2009
 4     04/01/2008     04/05/2011
 5     01/23/2009     01/25/2009

Resulting Data Set

Output 9.15 BUSINESS_DAYS Data Set

 Example 9.15 BUSINESS_DAYS Obs day1 day2 totaldays workdays holidays 1 07/01/2008 07/05/2008 4 2 1 2 06/23/2008 06/27/2008 4 4 0 3 05/19/2008 05/19/2009 365 255 6 4 04/01/2008 ...

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