I have monthly time series data that i want to adjust based on number of working days in the month. i figured how to exclude the weekends using the following macro:
data Regions2;
set Regions;
format Date last_day mmddyy10.;
do year = 2013 to 2016;
do month = 1 to 12;
Date = mdy(month, 1, year);
last_day = intnx('month', Date, 0, 'e');
days = intck('day', Date, last_day) + 1;
weekdays = intck('weekday', Date, last_day) + 1;
weeks = intck('week', Date, last_day);
hours = intck('dthour', dhms(Date, 0, 0,0), dhms(last_day, 23, 59, 59)) + 1;
work_hours = weekdays * 8;
by region;
output;
end; /* end month */
end; /* end year */
label
Date = 'First day'
last_day = 'Last day'
days = 'Days'
weekdays = 'Week days'
weeks = 'Weeks'
hours = 'Hours'
work_hours = 'Work hours'
;
drop month year;
run;
but how do i also take into account the holidays in the calculations above?
Thanks