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
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
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.
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 ;
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
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...
But do ensure you have a backup of your SAS Registry.
Hi,
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?
Best
krisraa
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
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.