BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
bibbnd
Fluorite | Level 6
I need to capture the 4th business day of the month and check to see if it is a holiday. if the day is a holiday than use the next business day.  I only need to check the 3 holidays listed below. 
 
options EVENTDS=(DEFAULTS); <== I ADD THIS BECAUSE OF ERROR BUT STILL DOESNT HELP

data _null_;
call symput('run_date',intnx('month',today(),0, 'b'));
run;

%put &run_date.;

 

/*SNAP SHOT BIZ DAY 4 */
data test; 
format new_bus_day bus  bus_DAY NEXT_BUS_DAY  date9.;
 
ARRAY hol(3)  $  Christmas USINDEPENDENCE newyear; 
 
bus_day = intnx('weekday',intnx('month','31jul2024'd, -1,'e'),4);
next_bus_day = intnx('weekday',intnx('month','31jul2024'd,-1,'e'),5);
 
 
DO I=1 TO 3;
        holiday=hol{i};
     IF holidaytest(holiday,bus_day)>0 THEN New_BUS_DAY=NEXT_BUS_DAY;
    ELSE New_BUS_DAY=BUS_DAY;
   END;
 
RUN;
i keep getting the following error when i try to use arrays to pass the value of the holidaytest fx
WARNING: In a call to the HOLIDAYTEST function or routine, the date keyword was not defined using the EVENTDS system option.
NOTE: Argument 1 to function HOLIDAYTEST(' ',23561) at line 45 column 9 is invalid.
WARNING: In a call to the HOLIDAYTEST function or routine, the date keyword was not defined using the EVENTDS system option.
NOTE: Argument 1 to function HOLIDAYTEST(' ',23561) at line 45 column 9 is invalid.
WARNING: In a call to the HOLIDAYTEST function or routine, the date keyword was not defined using the EVENTDS system option.
NOTE: Argument 1 to function HOLIDAYTEST(' ',23561) at line 45 column 9 is invalid.
new_bus_day=04JUL2024 business_day1=06JUN2024 bus_DAY=04JUL2024 NEXT_BUS_DAY=05JUL2024 business_day3=04JUL2024 business_day4=.
business_day5=. Christmas= USINDEPENDENCE= newyear= I=4 holiday= _ERROR_=1 _N_=1
NOTE: Mathematical operations could not be performed at the following places. The results of the operations have been set to
missing values.
Each place is given by: (Number of times) at (Line):(Column).
3 at 45:9
1 ACCEPTED SOLUTION

Accepted Solutions
ballardw
Super User

The first parameter of the HOLIDAYTEST function is a string value that hopefully is the name of a holiday.

 

Your array maybe should be:

ARRAY hol(3)  $ 20 _temporary_( 'Christmas', 'USINDEPENDENCE', 'newyear'); 

_temporary_ means the variables Hol1 through Hol3 are not added to your data set the the values in the parentheses initialize the array values.

View solution in original post

1 REPLY 1
ballardw
Super User

The first parameter of the HOLIDAYTEST function is a string value that hopefully is the name of a holiday.

 

Your array maybe should be:

ARRAY hol(3)  $ 20 _temporary_( 'Christmas', 'USINDEPENDENCE', 'newyear'); 

_temporary_ means the variables Hol1 through Hol3 are not added to your data set the the values in the parentheses initialize the array values.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 640 views
  • 1 like
  • 2 in conversation