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);

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

Register now!

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