06-26-2013 05:22 AM
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
06-26-2013 07:41 AM
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.
06-27-2013 04:54 AM
Please try Below one, well there is no direct sas command i found but something with combination of OS command will work like below.
call system ('rm -r libname');
06-27-2013 06:01 AM
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 ;
filename temp clear ;
libname myLib clear ;
06-27-2013 07:30 AM
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.
06-27-2013 08:48 AM
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
Usage Note 5013: Enable at Startup checkbox in the New Library Window is stored in the sasuser directory in the registry.sas7bitm file
If you navigate the registry, you will find the library assignment - simply delete the library you no longer want, in this case TEMP...
But do ensure you have a backup of your SAS Registry.
09-20-2017 05:14 PM
I'm using sas studio 3.5 in windows.
I have tried the "Libname mylib clear" and it was successfull.
Opened a new sas session and I can't see that library that has been deleted.
Now created library with the same but I haven't got any warnings/error?
Just curious about what could be the implications if we delete library using clear command and recreate those libraries again?
07-03-2013 01:15 PM
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.
Uma Shanker Saini