BookmarkSubscribeRSS Feed
Sid_Chaurasiya
Calcite | Level 5

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?

1 REPLY 1
SASKiwi
PROC Star

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.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

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!

Register Now

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1970 views
  • 1 like
  • 2 in conversation