BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Dontik
Obsidian | Level 7

Hi

Is there a way to extract a name of a library label/catalog name? I don't want librefs but the name of each of the assigned libraries that show up after entering "Libraries" catalog.

I basically what this:

SAS.png

Also, is it possible to assign multiple libraries? Usually assigning works like that - %libname (libref=name); but that allows assigning only one at a time. Is it possible to do some kind of a list?

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions
ChrisHemedinger
Community Manager

There's an example of this exact operation here:

Examples: DATA Step Functions for Reading Metadata

Chris

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.

View solution in original post

12 REPLIES 12
LinusH
Tourmaline | Level 20

Librefs don't actually have labels. But you may refer to their metadata name? Not sure what you mean by "extract", how do you wish to use it?

And again, how do you wish do assign your librefs? If it's for your personal use and you always want them assigned, add your libname statements in the Tools\Options\SAS programs\...?

Data never sleeps
Dontik
Obsidian | Level 7

I don't know how it's called but I want to list both libref and a corresponding name (catalog name/object name?) - the one from the example.

I don't always want to assign the same libraries, I only want certain libraries for certain tasks.

LinusH
Tourmaline | Level 20

To assign multiple librefs:

Mark the librefs you wish to assign (multiple choice using CTRL) - right click "Assign".

For librefs there this kind information available:

-libref (the "name" in the libname statement)

-metadata name

-metadata description

-search path (is this what you mean by "catalog"?)

-and many more engine specific options

Unfortunately I havn't found a way to get anything else than the meatadata name in the Server explorer pane.

You can query for active librefs using sashelp.vlibnam. No metadata information is available here, and my guess this is not what you are after.

I think we need to remember that EG is/was designed primarily for poser users, not end users. But more helpful features of the product is always welcome.

Data never sleeps
Dontik
Obsidian | Level 7

I know that's how I can assign multiple librefs but it's not what I want.. If you look at my first post, there's a code alternative for assigning single libraries by librefs. All I want is a silimar code to assign multiple (not single) libraries.

So there is a way to get the metadata name that is listed in the Server explorer pane?

mohamed_zaki
Barite | Level 11

check this :

proc sql;

 

   select *

      from dictionary.LIBNAMES

      ;

for more detials check: Accessing SAS System Information by Using DICTIONARY Tables

Dontik
Obsidian | Level 7

I've tried that but it doesn't store library name that is listed in the Server explorer pane.

ChrisHemedinger
Community Manager

Let me see if I understand your question.  You would like a method to assign just the small collection of librefs that you need for a given task, and clear all of the other librefs that aren't needed?  So the Libraries list would grow/shrink depending on the needs of your program/task at the time?

I'm not aware of a function/macro call that would do that.  However, you could devise a data-driven method yourself, using SAS macro language and either the LIBNAME statement or LIBNAME function.  Each of these assigns only one library at a time, but you could use the SAS macro language to generate multiple calls as needed based on the library details that are in some data set.

If your library definitions are stored in SAS metadata, then you would need to use SAS metadata functions to fetch the details of those libraries in order to generate proper LIBNAME assignments.  It's some work, but I can see it as feasible.

Chris

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
Dontik
Obsidian | Level 7

Thank you, it's seems like a good idea.

Yes, I think that my library definitions being stored in SAS metadata is the reason I couldn't find what I need.

Dontik
Obsidian | Level 7

Could you tell what would be the right metadata function?

ChrisHemedinger
Community Manager

There's an example of this exact operation here:

Examples: DATA Step Functions for Reading Metadata

Chris

It's time to register for SAS Innovate! Join your SAS user peers in Las Vegas on April 16-19 2024.
Dontik
Obsidian | Level 7

Thank you, it works perfectly!

jakarman
Barite | Level 11

You will not find the SAShelp and several other system libraries in the SAS metadata.
They are defined by the SAS System startup.
With a libname statement you can define one unique libref (like SASHelp) and that unique libref can be defined in the SAS metadata. In SAS metadata you can define logical table - records- element definitions associated to that.

With that association there is a very long metadata name for that libref possible.


When that long associated name does not exist you will see that libref name. For references you can need both names. SAS code does not that long name when it is running only that libref will work.

Eguide is supporting that long name when creating the nodes.  The cooperation of all that normally is transparent, getting into issue it can get easily confusing.    

---->-- ja karman --<-----

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 12 replies
  • 2406 views
  • 0 likes
  • 5 in conversation