BookmarkSubscribeRSS Feed
nbGuvnig
Calcite | Level 5

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

 

3 REPLIES 3
rajeshalwayswel
Pyrite | Level 9
%let car = ford;
%put &car;

Try in this way.

nbGuvnig
Calcite | Level 5

Let me clarify. I do NOT want to evaluate the macro variable. I want the macro variable name.

Astounding
PROC Star

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.

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1095 views
  • 0 likes
  • 3 in conversation