Hi,
I wish to identify and store the name of a macro variable in another macro variable. I have been able to identify the name of the macro variable by using the %put "&=" command, but haven't been able to assign it to either a variable (data step) or another macro variable.
%let car = ford; put &=car;
But how do I save the name from the log output to something tangible?
BR, Nis
%let car = ford; %put &car;
Try in this way.
Let me clarify. I do NOT want to evaluate the macro variable. I want the macro variable name.
It looks like you have already done what you asked about. If you want to refer to the name of the macro variable use:
&car
If you want to refer to the value stored within &FORD, use:
&&&car
If it's something else entirely, you willl have to give an example of why your code doesn't do what you need.
Are you trying to find the name of the macro variable that contains:
ford
Then examine dictionary.macros.
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.