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-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 397 views
  • 2 likes
  • 3 in conversation