0
votes

Whenever I login to the remote server in Enterprise guide I get overwhelmed with 100s of default libnames that I think has been assigned as the default configuration (I did not assign them individually with the libname statement)

enter image description here

This makes it difficult for me to look for the libraries that I am assigning using my code. If I right click on the library and click on unassign it throws an error (Plus its not feasable to right click and unassign all of them one by one).

I am guessing that all these libraries are assigned by default in some sort of a configuration file, but I am unable to find any link that explains how. I did go through the configuration file, but maybe I din't understand whatever was written in it.

Even if I were to somehow hide them that would be enough too.

I did look at this link, but I wasn't able to figure out where the libnames are stored.

PS I'm using SAS EG 7.13 with SAS 9.4

Edit: When I try un-assigning the libname directly it simply says "An unexpected error occurred"

The SAS System library may not be reassigned

If I try to unassign using the code by @Richard then it says

Warning: Library <Name> is not assigned in this scope

I did notice that all libraries created by me are created by the engine V9 where are the predefined libraries are by the engine base.

2
Hint. Prefix your librefs with _ or AA so that they appear at the top. At least then you can get some work done. - Tom

2 Answers

2
votes

You could try clearing all libnames at the start of your session using libname _all_ clear;.

However this won't remove the pre-assigned libraries. To do that, you'll need to update the settings in SAS Management Console, as per documentation:

enter image description here

There really isn't any need to remove those libraries though - you could just ask your admin to set up the permissions so that you (via your group) have only Read Metadata permission to those libraries that you need to access.

1
votes

This sample code will clear all librefs except the ones you list:

%let _CLEAR_LIBNAMES_STATEMENT=;

proc sql;
  reset noprint;
  select distinct "LIBNAME " || libname
  into :_CLEAR_LIBNAMES_STATEMENT separated by ";"
  from DICTIONARY.LIBNAMES
  where libname not in (
  'LIST OF LIBNAMES TO KEEP or CANT BE CLEARED'
  , 'WORK'
  , 'SASUSER'
  , 'SASHELP'
  , 'MAPS'
  , 'MAPSGFK'
  , 'MAPSSAS'
  )
  ;

&_CLEAR_LIBNAMES_STATEMENT;
%symdel _CLEAR_LIBNAMES_STATEMENT;

There are numerous points in the serving and connecting process where librefs can be defined. You state "throws an error" but do not state the error.

For the SASAPP folder in EG the libraries are likely setup by the server autoexec and management console settings. Libnames can also be created per user in their EG preferences (Tools/Options/SAS Programs/Submit when connected)

You can run the libname clearing code in your own EG connecting preferences, or as a project startup code block, or collaborate with your SAS Server admin if the libname one size fits all approach if affecting numerous users.