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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.