BookmarkSubscribeRSS Feed
Mahis
Pyrite | Level 9

Hello everyone,

We have a SAS script that runs every day. Most of the time it completes without any problems but randomly it fails with the error:

ERROR: Library WORK does not exist

The WORK library is in fact present and available when we check.

Has anyone experienced this kind of intermittent issue before and could you share ideas on how to investigate the root cause?

Environment details:
SAS 9.4 M6
OS: RedHat Linux

Thanks in advance!

7 REPLIES 7
MargaretC
SAS Employee

The error message you are seeing is coming from the Red Hat operating system.  Please check with RH as to why you are receiving this error message. 

 

An additional question, is your SAS WORK directory on an NFS file system?  

Mahis
Pyrite | Level 9

Thanks for your reply.

The SAS WORK library is on a local file system dedicated specifically for SAS WORK not on NFS.

AhmedAl_Attar
Ammonite | Level 13

Hi @Mahis 

Try adding this line at the start of your SAS script

libname _all_ list ;

It will write to the Log all the assigned library references  at the time of execution.

 

Keep in mind, SAS WORK library is typically auto-assigned via specifying its root location in 

  • sasv9.cfg file
  • sasv9_local.cfg file
  • -WORK <SomePath> command line option

Check your deployment/execution settings are not negatively affecting where the -WORK is pointing to

 

Hope this helps

Ksharp
Super User

Adding the following two rows at the top of your code.
But that would cost you lots of storage at SAS service side, due to not delete the temporary datasets produced by your sas code.

libname x '.';
options user=x ;
gwootton
SAS Super FREQ
Does this error occur while the SAS code is running or is it preventing the SAS session from starting at all?

SAS is provided a WORK option on startup specifying a parent location (e.g. /tmp). SAS will create a WORK library within that path specifically for it's process (e.g. /tmp/SAS_workFFFFFFFFFFF_hostname)

If the parent path specified by the WORK option is not accessible, SAS will fail to start with an error:
$ ./sas -nodms -work /tmp2

ERROR: Library WORK does not exist.
NOTE: Unable to initialize the options subsystem.
ERROR: (SASXKINI): PHASE 3 KERNEL INITIALIZATION FAILED.
ERROR: Unable to initialize the SAS kernel.

If SAS is running and some process deletes the WORK directory it created, you'll see this error in your code execution:
? data test; x=1; run;

ERROR: Library WORK does not exist.
NOTE: The SAS System stopped processing this step because of errors.

So, if you have some process set up to clean your WORK path periodically, it could be deleting your WORK directory from under you, causing this error.
--
Greg Wootton | Principal Systems Technical Support Engineer
Mahis
Pyrite | Level 9

In our case the script starts normally and runs through several steps without issues
The error appears only at the point where it needs to write an output dataset into WORK:

 

ERROR: Library WORK does not exist.

 

After that, the job keeps running until the end but whenever it references something that should be in WORK we get messages like:

 

ERROR: File WORK.TEST1.DATA does not exist.

 

So it looks like the WORK directory disappears (or becomes inaccessible) while the session is still active
The script itself doesn't stop completely it just keeps failing on any step that needs WORK

This happens randomly maybe 3 times a month while most other days the script finishes without any problem

Tom
Super User Tom
Super User

That seems consistent with a cleanup script that is accidentally removing WORK folders while the SAS process that is using them is still running.

 

Another thing to check is virus scans (and other scans) of the disk where WORK directories are made that might be temporarily locking access.  

 

Another thing to check is that the algorithm that is being used to generate the name of the directory used for work.  It that is accidentally causing two different processes to want to use the same name for the WORK library it might result in the first program having its work directory access removed because the new directory created for the second program is using different permission.  Or just plain deleting the files that the first program created.

suga badge.PNGThe SAS Users Group for Administrators (SUGA) is open to all SAS administrators and architects who install, update, manage or maintain a SAS deployment. 

Join SUGA 

Get Started with SAS Information Catalog in SAS Viya

SAS technical trainer Erin Winters shows you how to explore assets, create new data discovery agents, schedule data discovery agents, and much more.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 220 views
  • 7 likes
  • 6 in conversation