BookmarkSubscribeRSS Feed
BrahmanandaRao
Lapis Lazuli | Level 10
in work library  i assigned below macro variables i want assigned macro variables count in session

%let a=Alfred; %let b=William; %let c=Philp;

how to get macro variables count in a library

6 REPLIES 6
Tom
Super User Tom
Super User

I don't understand what the question is.

BrahmanandaRao
Lapis Lazuli | Level 10

how can we get macro variables count in a library 

for example i assigned three macro variables in a work library 

PaigeMiller
Diamond | Level 26

@BrahmanandaRao wrote:

how can we get macro variables count in a library 

for example i assigned three macro variables in a work library 


Please explain further. Macro variables are not associated with a library.

--
Paige Miller
BrahmanandaRao
Lapis Lazuli | Level 10
I assigned macro a b c using let
Reeza
Super User
Macro variables are per session so you can query the sashelp vmacro table for all user created macros in a session similar to other dictionary tables.
Tom
Super User Tom
Super User

Macro variables are not related to librefs or datasets.

You an query the DICTIONARY.MACROS metadata.

For example to find the number of GLOBAL macro variables you could use this query.

proc sql ;
select count(*) as n_macros
from  dictionary.macros where scope='GLOBAL' and offset=0 
;

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
  • 6 replies
  • 1430 views
  • 2 likes
  • 4 in conversation