From a server different from the SAS machine, we are running processes in batch mode on the SAS machine. These processes (process.sas) essentially create, delete, and regenerate a table in a library from an .egp file. In some cases, when we run the process outside of business hours, it executes in batch mode without issues. However, on certain occasions when we execute it during business hours, we have encountered situations where the table intended for deletion and regeneration is locked, possibly due to a user accessing it. This results in an error, but we cannot determine if the execution completed successfully or failed from the batch mode call.
To make the call, we use a command like the following example:
```sh
"/sas/config/Lev1/SASApp/BatchServer/sasbatch.sh -logconfigloc \"/sas/config/Lev1/SASApp/BatchServer/logconfig.xml\" -log /sas/config/Lev1/SASApp/BatchServer/Logs/"$1"_ -batch -noterminal -logparm \"rollover=session\" -sysin /sas/config/Lev1/SASApp/SASEnvironment/SASCode/Jobs/"$1""
```
We make this call from another server, not the SAS machine, using an SSH connection.
When a SAS process ends in error, it usually leave your a return code, unless someone specifically coded around it.
What does the log say?
Not sure how an egp (Enterprise Guide project) comes into the picture in this scenario.
Follow my last footnote to find ways to avoid the locking issue altogether.
The exit code of a process can be retrieved on UNIX with $?, so you can store that in a variable of your shell script. If you use this to exit on the remi'ote, non-SAS server, the scheduler can react to it.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.