Hi,
Could someone help me with any macros that i can use to schedule the report on 2nd working day of every month for UK
Thanks,
vnreddy
Hello,
Are you using SAS 9.4 or SAS VIYA 3.5 or SAS VIYA 4?
There are several ways to achieve this (as always 😉 ).
First thing might be to identify the 2nd working day of every month.
Here are some examples that you can use as a start :
/* FIRST MONDAY of the MONTH */
data _NULL_;
file print;
year = year(today());
do month = 1 to 12;
firstDayMonth = mdy(month, 1, year);
firstWorkDay = NWKDOM(1, 2, month, year);
PUT @1 firstDayMonth= weekdate.;
PUT @50 firstWorkDay = weekdate.;
end;
run;
/* second to last working day of the month */
/* Add HOLIDAYTEST Function (!!) to check if there's any holiday involved */
data _NULL_;
file print;
year = year(today());
do month = 1 to 12;
lastDay=intnx('weekday',intnx('month',mdy(month, 1, year),0,'E'),-1);
PUT @1 lastDay= weekdate.;
end;
run;
/* end of program */
Thanks,
Koen
Why do you need to use a SAS macro when a scheduling tool can do this without any coding? Ask your SAS administrator about this.
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.