BookmarkSubscribeRSS Feed
umashankersaini
Quartz | Level 8

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

7 REPLIES 7
esjackso
Quartz | Level 8

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

Tushar
Obsidian | Level 7


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.

MarkDawson
SAS Employee

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 ;

esjackso
Quartz | Level 8

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

MarkDawson
SAS Employee

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.

krisraa
Quartz | Level 8

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

umashankersaini
Quartz | Level 8

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

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 7 replies
  • 3877 views
  • 5 likes
  • 5 in conversation