BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
David_Billa
Rhodochrosite | Level 12

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;
1 ACCEPTED SOLUTION

Accepted Solutions
Patrick
Opal | Level 21

You could ensure that the macro variable always exists, i.e. by adding the following before your datastep.

%global mac_list;

 

View solution in original post

4 REPLIES 4
Patrick
Opal | Level 21

You could ensure that the macro variable always exists, i.e. by adding the following before your datastep.

%global mac_list;

 

David_Billa
Rhodochrosite | Level 12
Any other ways to solve the problem?
Patrick
Opal | Level 21

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;

 

Amir
PROC Star

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.

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 4 replies
  • 775 views
  • 2 likes
  • 3 in conversation