In my recent blog post Shifting a date by a given number of workdays I address this problem using SAS user-defined format dayoff. and user-defined function shiftwd(). The approach takes into account business days excluding weekends and holidays, and it is not specific for any country or jurisdiction.
Using this function, adding (or subtracting) business days to a date will look like this:
data EVENTS_WITH_SHIFTS;
set EVENTS;
BEFORE_DATE = shiftwd(EVENT_DATE,-10); /* Decrement EVENT_DATE by 10 workdays */
AFTER_DATE = shiftwd(EVENT_DATE, 12); /* Increment EVENT_DATE by 12 workdays */
format BEFORE_DATE AFTER_DATE date9.;
run;
There is also a SAS macro solution described there:
data EVENTS_WITH_SHIFTS;
set EVENTS;
%shiftwd(fromvar=EVENT_DATE,endvar=BEFORE_DATE,wdays=10,sign=-); /* Decrement EVENT_DATE by 10 workdays */
%shiftwd(fromvar=EVENT_DATE,endvar=AFTER_DATE, wdays=12,sign=+); /* Increment EVENT_DATE by 12 workdays */
format BEFORE_DATE AFTER_DATE date9.;
run
See the blog post for more details: Shifting a date by a given number of workdays .
... View more