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;