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

Hi SAS users,

 

Need a help !

 

I have a macro that is resolving to client as abc in the log.But when i call that in a macro, i am getting the below error.

 

client is resolving correctly like example abc.

 

%macro &client._call (parms = );


ERROR: Invalid macro name &. It should be a valid SAS identifier no longer than 32 characters.
ERROR: A dummy macro will be compiled.

 

 

Thanks,

Ana

1 ACCEPTED SOLUTION

Accepted Solutions
heffo
Pyrite | Level 9

Hi, are you trying do define a macro called abc_call (parms = ) or do you want to call the macro that is called abc_call? I am not sure if you can create a sas macro program name based on macro variables. But, that is just my guess. But, if you want to call a predefined macro based on a macro variable, that seem to be working. 

 

%let client=abc;

%macro abc_call (parms = );
	%put This is the inparameters &=parms;
%mend; 

%&client._call(parms=Hello World);

View solution in original post

2 REPLIES 2
Tom
Super User Tom
Super User

Looks like you are confusing defining a macro and calling a macro. You use the %MACRO statement only when defining the macro.  You have to give the macro an actual name when you defined it.

%macro mymacro; ... %mend;

But you could use a macro variable to resolve to the name of the macro you want to call.

%let want_to_call = mymacro;
%&want_to_call;
heffo
Pyrite | Level 9

Hi, are you trying do define a macro called abc_call (parms = ) or do you want to call the macro that is called abc_call? I am not sure if you can create a sas macro program name based on macro variables. But, that is just my guess. But, if you want to call a predefined macro based on a macro variable, that seem to be working. 

 

%let client=abc;

%macro abc_call (parms = );
	%put This is the inparameters &=parms;
%mend; 

%&client._call(parms=Hello World);

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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