Hello Everyone,
I have a macro called Copy_Datasets. It reads an input file and appends the word "holiday" to the end of the file name if today's date is one of the holidays defined in the holiday_file. When I run the macro i get an error "Required operator not found in expression: &today. in (&Holiday_List.)" from the macro. Does anyone have any suggestions as to how I can fix this issue? I have listed my code below. Thank you!
Data holiday_file;
input holidays dates9.;
datalines;
16jun2014
04jul2014
01sep2014
;
run;
proc sql;
select distinct holidays into : holiday_list
seperated by ', '
from holiday_file;
quit;
%Let today = $sysfunc(today());
%macro Copy_Datasets(infile);
%if &today. in (&holiday_list.) %then %do;
data &infile._holiday;
set &infile.;
run;
%end;
%mend;
%Copy_Datasets(cust_file)
Hello KevinC,
Is system option "minoperator" set? See: SAS(R) 9.4 Macro Language: Reference
%Let today = $sysfunc(today());
% instead of $ sign?
As well as dateS9 instead of date9 in the first input program.
Hello KevinC,
Is system option "minoperator" set? See: SAS(R) 9.4 Macro Language: Reference
Thank you all for your reply, I really appreciate it!
Jason,
I added the options minoperator and it resolved the issue.
Thank you everyone again
In addition to the other comments you already received, I believe that the macro version of the IN operator does not use parentheses around the list of values.
The macro language is not well suited to the task of table look up. Consider this approach which does not involve macro language.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.