10-21-2014 08:42 AM
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:
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!
10-21-2014 08:46 AM
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\...?
10-21-2014 08:53 AM
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.
10-21-2014 09:02 AM
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)
-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.
10-21-2014 09:15 AM
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?
10-21-2014 09:31 AM
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.
10-21-2014 09:39 AM
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.
10-21-2014 11:05 AM
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.
Need further help from the community? Please ask a new question.