BookmarkSubscribeRSS Feed
PaigeMiller
Diamond | Level 26
1751  libname cam_dial clear;
ERROR: Unable to clear or re-assign the library CAM_DIAL because it is still in use.
ERROR: Error in the LIBNAME statement.

Why does this happen? I know that if I have a data set open from that library, I get this message, but I do not have any data set open. So what else could it be causing this ERROR?

 

How can I fix it? (The only solution I have found so far is to shut down SAS, which is often something I don't want to do just to clear a LIBNAME).

 

--
Paige Miller
10 REPLIES 10
RichardDeVen
Barite | Level 11

What is the libname statement that defines the libref ?

 

What is the client and server environment ? Display Manager, Enterprise Guide to remote server, SAS Studio ? Other ?

PaigeMiller
Diamond | Level 26

Base SAS Version 9.4 TS1M5, although this has been happening infrequently for many years

Windows 10 accessing folders on a server

 

libname cam_dial "G:\myfolder\indirect";

The libname works when I assign it, and I can access all the SAS data sets in the folder. It's only when I try to clear the libname that I have the problem.

--
Paige Miller
ballardw
Super User

I have a strong suspicion that this is a WINDOWS bug.

 

I have very seldom had this happen with SAS libraries. But I fairly often have Windows tell me I can't delete a file, rename a data file "because the file is in use". If so, I really wish Windows would tell me what is using the file as the only application I know that I have open at the time are Windows Explorer and Outlook.

 

If this hadn't been happening before I was required to move all of my work files to One-Drive I would think it might be some latency issue in One-Drive but this had happened with files on my local drive.

 

The issue may persist until I shut down my computer where I would get a message about not shutting down because file xxx is in use.

 

PaigeMiller
Diamond | Level 26

@ballardw I can't rule that out, although the recent rash of occurrences of this issue corresponds with the same time period where I am using DOSUBL in a program. Coincidence? Could be ... but I'm still hoping to find the cause.

--
Paige Miller
mkeintz
PROC Star

I presume you are implying that this has ONLY happened when assigning a libname to a directory on a server.  I've certainly never had this problem in any context. 

 

Even though the error message implies that it is SAS that is not properly monitoring libname usage, maybe there is a network status flag or configuration component that occasionally prevents SAS from doing its job.  It's a reach I know, but if there is a difference in behaviors between libnames assigned to local vs server directories, I have to ask.  BTW, I wouldn't have a clue as to how to dig into this.

 

 

 

Presumably the network environment is such that SAS can't confirm the status of the 

 

I would have no clue to a remedy but perhaps you can give some particulars about the network protocol and configuration.

--------------------------
The hash OUTPUT method will overwrite a SAS data set, but not append. That can be costly. Consider voting for Add a HASH object method which would append a hash object to an existing SAS data set

Would enabling PROC SORT to simultaneously output multiple datasets be useful? Then vote for
Allow PROC SORT to output multiple datasets

--------------------------
PaigeMiller
Diamond | Level 26

@mkeintz I only store SAS data sets on a server, so the problem could be related to the server. I have no clues about network configuration and protocol.

--
Paige Miller
RichardDeVen
Barite | Level 11
Just to be certain, is G: mapped to a network share ? If so, what kind of
machine or platform is hosting the share ?
Tom
Super User Tom
Super User

Things to check.

 

Are not browsing one the datasets in the library?

Did you open the library with any of the old SCL functions like OPEN() and forget to close it?

Did you use the libref in some other options like FMTSEARCH that would keep the libref in use?

 

Do you really need to write the library?  What happens if you initially define the libref with the ACCESS=READONLY option?

SASKiwi
PROC Star

In addition to @Tom 's checklist add any SAS procedure that is accessing that library that requires a QUIT statement to exit. Examples are PROC SQL, PROC DATASETS.

PaigeMiller
Diamond | Level 26

From @Tom 

 

Are not browsing one the datasets in the library? None

Did you open the library with any of the old SCL functions like OPEN() and forget to close it? No 

Did you use the libref in some other options like FMTSEARCH that would keep the libref in use? No

 

Do you really need to write the library?  What happens if you initially define the libref with the ACCESS=READONLY option? I do need write access.

 

From @SASKiwi 

 

In addition to @Tom's checklist add any SAS procedure that is accessing that library that requires a QUIT statement to exit. Examples are PROC SQL, PROC DATASETS. I will check this, that sounds possible, I have written a very long macro, and it could be that somewhere in there I am missing a quit.

 

Another thought I had is that sometimes I have to stop the macro while it is running, so I hit the break icon. (This is usually because I have provided an incorrect argument somewhere, rather than bugs, which I think are few) Maybe that's where the issue comes in, and would explain why this is not repeatable. If that is a possibility, its not clear to me how to verify this or fix this, if you have any ideas, please let me know.

 

--
Paige Miller

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 10 replies
  • 3901 views
  • 1 like
  • 6 in conversation