Desktop productivity for business analysts and programmers

Library label/catalog name

Accepted Solution Solved
Reply
Contributor
Posts: 25
Accepted Solution

Library label/catalog name

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!


Accepted Solutions
Solution
‎10-21-2014 10:09 AM
Community Manager
Posts: 2,696

Re: Library label/catalog name

There's an example of this exact operation here:

Examples: DATA Step Functions for Reading Metadata

Chris

View solution in original post


All Replies
Esteemed Advisor
Posts: 5,198

Re: Library label/catalog name

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
Contributor
Posts: 25

Re: Library label/catalog name

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.

Esteemed Advisor
Posts: 5,198

Re: Library label/catalog name

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
Contributor
Posts: 25

Re: Library label/catalog name

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?

Super Contributor
Posts: 490

Re: Library label/catalog name

check this :

proc sql;

 

   select *

      from dictionary.LIBNAMES

      ;

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

Contributor
Posts: 25

Re: Library label/catalog name

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

Community Manager
Posts: 2,696

Re: Library label/catalog name

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

Contributor
Posts: 25

Re: Library label/catalog name

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.

Contributor
Posts: 25

Re: Library label/catalog name

Could you tell what would be the right metadata function?

Solution
‎10-21-2014 10:09 AM
Community Manager
Posts: 2,696

Re: Library label/catalog name

There's an example of this exact operation here:

Examples: DATA Step Functions for Reading Metadata

Chris

Contributor
Posts: 25

Re: Library label/catalog name

Thank you, it works perfectly!

Valued Guide
Posts: 3,206

Re: Library label/catalog name

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 --<-----
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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