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.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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