Hi Guys, I use this code to get the date of Monday and Friday from previous week -
%let first_day=%sysfunc(intnx(week.2,%sysfunc(today()),-1,b),date9.);
%put first_day=&first_day ;
%let last_day=%sysfunc(intnx(week.6,%sysfunc(today()),0,b),date9.);
%put last_day=&last_day ;
The macro is usable for most weeks, except when there's a holiday on Monday or Friday. How can I get the next working day if there's a holiday on Monday and previous working day if it is a holiday on Friday?
Holidays vary from country to country, state to state, province to province, and even from business to business. Where I live and with the business I work in - banking - we ignore provincial holidays but count national ones as far as "business" days are concerned.
The only sure way of dealing with this is to create your own holidays dataset for your particular location and use that to derive what you want.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.