The following error message might be generated when you try to delete a data set using PROC DATASETS:
ERROR: A lock is not available for dsname.DATA, lock held by another process.
In Microsoft Windows environments, for example, you might have software such as Diskeeper or DiskXtender running. Some of the archival software programs wait for a new or updated file to be changed and then immediately open it in order to copy it to the archival location. When that occurs, the data becomes locked from the SAS session.
One way to determine whether other software is accessing your SAS files is to use Process Monitor, which is free downloadable software available from the Microsoft Windows Sysinternals web site.
The SAS system option FILELOCKWAIT is valid at startup and can be used to specify the number of seconds that SAS will wait for a locked file to become available.
If you are unable to obtain a lock but want to continue trying to obtain that lock for a period of time, you can use the SLEEP function to attempt a lock periodically, as shown in SAS Note 51275, "Locking a data set and verifying that a lock is held."
If you are using SAS® Enterprise Guide®, see Tip: How to close all data sets in SAS Enterprise Guide. Note that SAS/SHARE® software provides concurrent update access and avoids the problem of receiving this error regarding a locked data set.