BookmarkSubscribeRSS Feed
vnreddy
Quartz | Level 8

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

2 REPLIES 2
sbxkoenk
SAS Super FREQ

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

SASKiwi
PROC Star

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.

sas-innovate-wordmark-2025-midnight.png

Register Today!

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.


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
  • 2 replies
  • 702 views
  • 2 likes
  • 3 in conversation