Although you're doing hours, this is probably the same question:
https://communities.sas.com/t5/SAS-Programming/Finding-the-next-working-day-with-a-custom-calendar/td-p/477859
You really do want to create a custom calendar though, it'll save you a lot of time and headache once you get it working. It's tedious but not complicated.
This is perhaps the better reference:
https://communities.sas.com/t5/SAS-Communities-Library/SAS-Tip-Generating-Holiday-Lists/ta-p/557799?title=Generating_Holiday_Lists
@sas1011 wrote:
Hello,
I have been breaking my head trying to get this to work.
I have a data set with two datetime columns and another dataset with list of holidays and weekends.
I need to calculate the total hours between the two datetimes - and if any holiday and/or weekend falls between these dates, that day(24hours) needs to be removed from the total.
Please help me with the easiest way to do it.
This is what I am working with in terms of logic:
data want;
set have;
var1=0;
array hol(*) hol1-hol141;
do i=1 to dim(hol);
if hol(i) ge datepart(datetime1) and hol(i) le datepart(datetime2) then
var1+24;
Net_hours=(intck('seconds', datetime1, datetime2)/(60*60)) - var1;
run;
... View more