BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
RobWanders1
Fluorite | Level 6

I am trying to read options from a library and store them into a macro. Specifically I want to retrieve the caslib that a library point to (see screenshot) but a general method to retrieve properties of a library would help me.

eg_example.png

With "libname example list" I do get the information I need but it is written to the log. Is there a way to write it to a macro value (which I can later parse to get only the info I need). I did read about proc printto here to redirect the log to a file, which I can then read and parse. But I'd prefer to write the output of "libname example list" directly to a macro value.

 

Other methods to read library properties are also welcome, although meta-queries are no option since this should also work for libraries that are not registered in metadata.

1 ACCEPTED SOLUTION

Accepted Solutions
LinusH
Tourmaline | Level 20

Since you have a SAS Compute libref, you can use DICTIONARY.LIBNAMES from PROC SQL:

proc sql;
   select libname, sysvalue
      from dictionary.libnames
      where upcase(sysname) = 'CASLIB';
quit;

With INTO: you can store the result in a macro variable.

 

Data never sleeps

View solution in original post

2 REPLIES 2
LinusH
Tourmaline | Level 20

Since you have a SAS Compute libref, you can use DICTIONARY.LIBNAMES from PROC SQL:

proc sql;
   select libname, sysvalue
      from dictionary.libnames
      where upcase(sysname) = 'CASLIB';
quit;

With INTO: you can store the result in a macro variable.

 

Data never sleeps
RobWanders1
Fluorite | Level 6

Thanks for the quick response Linus, this does exactly what I was looking for! I wasn't aware of this dictionary.

sas-innovate-white.png

Our biggest data and AI event of the year.

Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.

Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.

 

Register now!

Creating Custom Steps in SAS Studio

Check out this tutorial series to learn how to build your own steps in SAS Studio.

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
  • 2 replies
  • 1004 views
  • 2 likes
  • 2 in conversation