04-26-2010 04:42 PM
04-26-2010 04:56 PM
03-28-2013 07:26 AM
To find the next business day , use INTNX('WEEKDAY',...) - see code below.
if Thisdate = intnx('WEEKDAY',Thisdate,0) then NextWorkday=Thisdate; else NextWorkday=intnx('weekday',Thisdate,1);
To find the previous business day, simply use
PreviousBusinessday = intnx('weekday',Thisdate,0) ;
This does not take into account holidays, only Saturday & Sunday.
In Saudi Arabia, where weekend is on Thursday & Friday, use this code instead
intnx('weekday56w',Thisdate,0) ; see SAS(R) 9.2 Language Reference: Dictionary, Fourth Edition
03-28-2013 11:13 AM
And, if you need to expand the holiday function to incorporate holidays that aren't already included in the holiday function, take a look at the customizable holiday function at: http://www.sascommunity.org/wiki/Sometimes_One_Needs_an_Option_with_Unusual_Dates