BookmarkSubscribeRSS Feed
peterPNFP
Calcite | Level 5

I know filelockwait can be added to a libname statement, but how could I give this option to the work library?

 

Your help is much appreciated!

 

Peter

7 REPLIES 7
ballardw
Super User

Are you sharing your Work library with another user?

Why do you think you need to set this for your Work library?

peterPNFP
Calcite | Level 5

Because we encounter a lot of random lock errors when running large datasets over many iterations. Currently we modified our codes to move some datasets to a user-defined library with the filelockwait option, but if we can have the option to the work library, we don't need to change many of our codes. 

ballardw
Super User

"We" implies some group which leads me to believe that this is a server environment. Talk to your SAS admin about looking to the setting of the server using FILELOCKWAITMAX.

 

But "random" issues like this quite often points to some sort of network constraint or workload issue  and it may be worth working with SAS technical support to identify and address the cause of the "random" issue.

Quentin
Super User

Can you provide example code that replicates the problem?  Maybe simulate a dataset, and show how you're iterating and seeing random lock conflicts?  I've never seen a lock error for the work library.  If your work library is on a network / server, I'd be suspicious of backup routines or virus scans or something like that.

BASUG is hosting free webinars Next up: Mike Sale presenting Data Warehousing with SAS April 10 at noon ET. Register now at the Boston Area SAS Users Group event page: https://www.basug.org/events.
SASKiwi
PROC Star

You most definitely should not be getting file locking problems with SAS WORK libraries, especially if you are referring to batch SAS processing. You can run into locking issues with SAS EG or the SAS Windowing System if you are viewing a WORK table at the same time as updating it but you can only fix those by closing the SAS viewer.

 

I suggest you provide more details of examples where this is happening.

Patrick
Opal | Level 21

@peterPNFP wrote:

Because we encounter a lot of random lock errors when running large datasets over many iterations. Currently we modified our codes to move some datasets to a user-defined library with the filelockwait option, but if we can have the option to the work library, we don't need to change many of our codes. 


Each SAS session creates its own session specific WORK area. It's impossible that a SAS process from one session locks a table in WORK that belongs to a different session.

Within the same SAS session there is only one process that executes at a time so also there no locking can occur. 

 

The only way to lock a table in WORK with SAS is when you use a client like EG or Studio and you open a table and then run a SAS script in the same session that tries to write access (drop, create, update, insert) this table. 

If that's the problem then for EG (and there must be something similar for Studio) set below option.

Patrick_0-1711518311504.png

 

If above is not the problem then some other non-SAS process must be locking the table. The most common culprit is a virus scanner.

That's something your IT guys would need to investigate and then amend their rules to exclude *.sas7b* files from scanning.

 

You could use "trickery" along the line of what @Ksharp proposes - but I would point the new libref still to the WORK folder as that's for a good designed environment the storage location with the best I/O available.  I don't recommend to use below code as it's a workaround obfuscating a problem instead of solving it. ...and if it's a virus scanner or the like that's causing the issue then the workaround wouldn't even work as it still stores the tables in the same location as WORK.

libname work2 "%sysfunc(pathname(work))" filelockwait=200;
options user=work2;

data x;
 set sashelp.class;
run;

 

Ksharp
Super User

You could make your library be WORK library.

Like the following:

 

libname x v9 'c:\temp\' filelockwait=200;

options user=x;

data x;
 set sashelp.class;
run;

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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
  • 370 views
  • 2 likes
  • 6 in conversation