As auxiliary functions of isBusinessDay, previousBusinessDayand nextBusinessDay, the functions ifNonBDayPreviousBDay and ifNonBDayNextBDay test whether the informed date is a business day, if not, it returns the previous or subsequent business day date, respectively to each function.
proc fcmp outlib=work.sas_functions.dateFunctions; /* =================== * FUNCTION:ifNonBDayPreviousBDay * AUTHOR: Dutra - dutra@relevants.org * DESCRIPTION: Checks if the given date is a working day, otherwise returns the previous working day date =================== */ function ifNonBDayPreviousBDay(date); if isBusinessDay(date) = 0 then return(previousBusinessDay(date)); else return(date); endsub; /* =================== * FUNCTION:ifNonBDayNextBDay * AUTHOR: Dutra - dutra@relevants.org * DESCRIPTION: Checks if the given date is a working day, otherwise returns the next working day date =================== */ function ifNonBDayNextBDay(date); if isBusinessDay(date) = 0 then return(nextBusinessDay(date)); else return(date); endsub; quit;
Top comments (0)