DEV Community

Dutra
Dutra

Posted on

1 1

SAS Function isBusinessDay

This is an auxiliary function to isBrHoliday, demonstrated in the previous post, to validate whether a date is a business day, disregarding weekends and holidays. the code can be added along with the previous block inside proc fcmp.

proc fcmp outlib=work.sas_functions.dateFunctions;

    /*
    =================== 
     * FUNCTION:isBusinessDay
     * AUTHOR: Dutra - dutra@relevants.org
     * DESCRIPTION: Tests a date to validate if it is a 
Brazilian national holiday or non-business day, returning 0 or 1.
    ===================
    */
    function isBusinessDay(date);

        if weekday(date) in (1, 7) or isBrHoliday(date) = 1 then
            return(0);
        else return(1);

    endsub;


quit;

options cmplib=work.sas_functions;
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

Qodo Takeover

Introducing Qodo Gen 1.0: Transform Your Workflow with Agentic AI

Rather than just generating snippets, our agents understand your entire project context, can make decisions, use tools, and carry out tasks autonomously.

Read full post

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay