Desktop productivity for business analysts and programmers

LOCK (Retrieve SYSUSERID instead of JOB_ID) - how to

Posts: 20

LOCK (Retrieve SYSUSERID instead of JOB_ID) - how to

ERROR: Lock held by process 346


I'd like to know directly who is using the Dataset and not the JOB_ID

Is it possible to retrieve like: "Lock held by user 1234" (that &SYSUSERID macro variable)??


  • SAS Enterprise Guide 6.1
  • X command unabled


Super User
Posts: 5,912

Re: LOCK (Retrieve SYSUSERID instead of JOB_ID) - how to

With the pid you can look up the user by using OS tools/commands.
What is the underlying requirement?
There have been numerous threads discussing this is, sugest that you browse these.
Bottom line: if you have frequent problems with locking switch to a multi user data store, or implement a script that kills all SAS processes prior to batch processing.
Data never sleeps
Super User
Posts: 10,527

Re: LOCK (Retrieve SYSUSERID instead of JOB_ID) - how to

You will need to use OS tools enabled to do this.

To do it manually, log on to the server with ssh and use something like ps -ef|grep processnumber

To do it automatically in SAS, you MUST have XCMD enabled.


My preferred method to avoid this is to physically delete the target dataset file using OS commands (works on UNIX like a charm) before writing it.

Maxims of Maximally Efficient SAS Programmers
How to convert datasets to data steps
How to post code
Ask a Question
Discussion stats
  • 2 replies
  • 3 in conversation