With SAS/Enterprise Guide 4.1 running SAS on a Windows server we experience numerous occasions where one user might be browsing a SAS dataset (in the default read-only mode) and another user needs to run some code to update that same dataset. By having the dataset open in browse mode, the first user is preventing the second user from being able to update the dataset.
The second user receives the following message:
ERROR: A lock is not available for BANANA.SHOES_DAVE.DATA, lock held by another process.
Whilst it is annoying that the read-only mode is not actually read-only, we would really like to be able to identify which user has a particular dataset open so that we can contact that user and ask them to close the dataset in question. We have several hundred users and, at present, are only able to send an eMail to all users to ask them to check to see if they have the dataset open.
Does anyone know a way that we can identify the user or the session ID that has the dataset open in browse mode. There does not seem to be a .lck file created for this situation as there is when user #1 is updating the dataset themsleves, perhaps with a Proc Sort.
I had thought that the LOCK statement would help identify the user with the dataset open but apparently not.
Any thoughts or clever ideas? Whilst it would be nice if the solution was within SAS, we could live with a DOS/Windows workaround.
I think that SAS is just using the windows file locking tools. Because SAS datasets are direct access, regular SAS reads have to lock the entire file.
If so, you can use this "Hnadle" tool to find the users who have the files open. ( http://technet.microsoft.com/en-us/sysinternals/bb896655.aspx ). It runs with a Unix-like structure, so you could easily launch it from within SAS, parse the results, and send an e-mail just to the appropriate user. (I haven't tried it.)