The SAS Output Delivery System and reporting techniques

How to delete a permanent library permanently.

Reply
Frequent Contributor
Posts: 113

How to delete a permanent library permanently.

Hi All,

Kindly let me know how to delete a permanent library permanently.

I have already checked in community history as well, it has not been answered.

(1) Libname libraryname clear  ----- is not working (it is only working for current session only, once session restart, library would be there as 'enable at startup' option is selected)

(2) proc datasets lib=libraryname kill; .......... and like these are only to delete datasets not to delete library.

Thanks & Regards

Uma Shanker Saini

Super Contributor
Posts: 333

Re: How to delete a permanent library permanently.

You didnt mention how your SAS is setup or if you are talking about one of the server products.

Most of the time in Base SAS, the library is only a folder on a computer or network share. It will be defined either through the current code or through the autoexec. The libname is really just a pointer to these things so really what you are looking for is where it is being defined and deleteing out that option or code. Even if you deleted the actual folder the code is pointing too you would get errors that say location could not be found. If its available from the start of SAS, I would start my search in the autoexec file.

EG and the server products have interfaces to define libnames as well as in code, so it does depend on what is being used in your installation.

EJ

Frequent Contributor
Posts: 88

Re: How to delete a permanent library permanently.


Hello Umashanker,

Please try Below one, well there is no direct sas command i found but something with combination of OS command will work like below.

data _null_;

call system ('rm -r libname');

run;

Regards,

Tushar Jagtap.

SAS Employee
Posts: 4

Re: How to delete a permanent library permanently.

You can do this entirely with SAS Funtions, and I also believe this will work on any OS including z/OS...

   libname myLib 'c:\temp\test1' ; * Assign library ;

   proc datasets library=myLib kill ; quit ; * Delete contents ;

   filename temp "%sysfunc(pathname(myLib))" ; * Assign fileref to same location as library ;

   data _null_ ;

      rc = fdelete('temp') ; * Delete the directory which must be empty ;

      put rc= ; * 0 if successful ;

   run ;

   filename temp clear ;

   libname myLib clear ;

Super Contributor
Posts: 333

Re: How to delete a permanent library permanently.

You are correct that in both methods that the directory will be deleted. But the libname reference will only be cleared in the current session. If the libname is assigned elsewhere there will still be warnings / errors saying that the folder does not exist and libname cannot be assigned every time SAS starts.

The only way to stop the assignment is find the code or UI piece that actually doing the assignment. Not knowing more about the setup its hard to provide anymore help that this.

EJ

SAS Employee
Posts: 4

Re: How to delete a permanent library permanently.

Just reread the original post - to remove libraries that have been set to "assign at startup" review these SAS Notes...

Usage Note 7129: How to view a list of libraries assigned from the New Library icon when Enable at Startup is selected

http://support.sas.com/kb/7129

Usage Note 5013: Enable at Startup checkbox in the New Library Window is stored in the sasuser directory in the registry.sas7bitm file

http://support.sas.com/kb/5013

If you navigate the registry, you will find the library assignment - simply delete the library you no longer want, in this case TEMP...

AssignAtStartup.png

But do ensure you have a backup of your SAS Registry.

Frequent Contributor
Posts: 113

Re: How to delete a permanent library permanently.

Thank you so much for reply....

Sukmrd : I will get back to you once, i will apply (currently running by time).

Esjack..: i will get back to you with all system information.

Regards

Uma Shanker Saini

Post a Question
Discussion Stats
  • 6 replies
  • 682 views
  • 5 likes
  • 4 in conversation