## How to find Nth business day incl holidays

Solved
Occasional Contributor
Posts: 5

# How to find Nth business day incl holidays

[ Edited ]

Our database updates on the 8th business day of the month so I need to create some date parameters that will depend whether or not the current day falls on or before/after the 8th business day.

Just to be clear, I'm just asking for code to identify the 8th business day, not code for creating the date parameters.  :-)

I currently use SAS EG 7.13 and SAS 9.

Accepted Solutions
Solution
‎03-19-2018 09:45 AM
Super User
Posts: 24,028

## Re: How to find Nth business day incl holidays

business_day = intnx('weekday', intnx('month', today(), 0, 'b'), 8);

If you have custom intervals, which you likely do, you need to build your own custom calendar to account for the holidays and then you can use that interval instead.

All Replies
Super User
Posts: 24,028

## Re: How to find Nth business day incl holidays

You can use TODAY() to generate todays date and then DAY() to get the day of the month.

It's not quite clear what you're looking for besides that.

Solution
‎03-19-2018 09:45 AM
Super User
Posts: 24,028

## Re: How to find Nth business day incl holidays

business_day = intnx('weekday', intnx('month', today(), 0, 'b'), 8);

If you have custom intervals, which you likely do, you need to build your own custom calendar to account for the holidays and then you can use that interval instead.

Occasional Contributor
Posts: 5

## Re: How to find Nth business day incl holidays

Thanks!   I was kind of hoping for a way around the custom calendar thing.   I tried a set of code that employed the holiday function but even that had flaws.

But thanks for the tip!

Super User
Posts: 24,028

## Re: How to find Nth business day incl holidays

The custom calendar isn't as hard as it seems though it was intimidating the first time I tried to figure it out.

If you're in US you can use the following to make your holiday lists:

http://www.sascommunity.org/wiki/Generating_Holiday_Lists

☑ This topic is solved.