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
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);
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;
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);
Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.
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.
Ready to level-up your skills? Choose your own adventure.