When I try to execute the code below, I'm getting error stating that ,
ERROR 180-322: Statement is not valid or it is used out of proper order.
WARNING: Apparent symbolic reference MAC_LIST not resolved.
Now I would like to execute the macro even when the macro MAC_LIST is not resolved. I don't want to see the error and also I want program to continue processing.
data &_OUTPUT.(keep= FLT_ID RUN_ID);
set &_INPUT.;
&mac_list.;
run;
You could ensure that the macro variable always exists, i.e. by adding the following before your datastep.
%global mac_list;
You could ensure that the macro variable always exists, i.e. by adding the following before your datastep.
%global mac_list;
Not as simple as using a %global statement (or a %local statement within a macro definition).
If your code is within a SAS macro definition then you can also use %symexist as below:
/*%let mac_list= newvar=1;*/
%macro test();
data sample;
set sashelp.class;
%if %symexist(mac_list) %then &mac_list; ;
run;
%mend;
%test();
proc print data=sample;
run;
Hi @David_Billa thanks for supplying the code and the error message, as it helps coming up with a solution.
If any of @Patrick 's responses works for you then please accept it (not my post) as the solution.
Thanks & kind regards,
Amir.
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.