Terminating a SAS Program from EG

New Contributor
Posts: 4

Terminating a SAS Program from EG

I would like to have my enterprise guide SAS processes stop and exit the windows environment completely if certain conditions are met.  I now use the "ABORT RETURN" command which works to stop the job from running, but it doesn't exit the program - it pops a dialogue window and the session stays open but hung up.  Is there a command that will get it to stop the running task and fully exit the session / close the EG program?

Related question, I read elsewhere that if SAS terminates like this, it may leave some temporary files on the computer as a byproduct, since they don't get cleaned up by the normal EG exit process.  Where would these reside if this is true so that I could scrub them periodically?


Contributor hbi
Posts: 66

Re: Terminating a SAS Program from EG

I am not aware of a way to close down EG (from EG itself) programatically. There would be many implications if such a feature existed (e.g. Windows dialog boxes prompting you to save existing work, what happens if there is no user sitting in front of the computer to respond, etc.). 


I believe that the commands "ABORT RETURN" and "ABORT ABEND" set the _ERROR_ variable to 1, which means it will show up as such in your log output. 


As you say, it terminates further execution, but the Unix process itself remains. You will need to log into Unix (using something like Putty), display all the old "sas" processes running under your user ID ("ps -u JohnDoe") and then "kill -9" each one:



$ ps -u JohnDoe
  PID TTY          TIME CMD
 7226 pts/0    00:00:00 ps
68064 ?        00:00:01 sas
65181 ?        00:00:00 sas
65771 ?        00:00:00 sas
67417 ?        00:00:00 sas

$ kill -9 68064
$ kill -9 65181
$ kill -9 65771
$ kill -9 67417



To scrub old "work" folders, you'll need to go to the subfolder "/sastemp" and look for folders that you own. You could do this too in Putty, but I prefer to use a tool such as FileZilla, because I can target which "/sastemp/SAS_work" and "/sastemp/SAS_util" folders to delete visually (based on owner, timestamp, etc.). 



Be careful not to delete your colleagues' work folders accidentally (this could happen if you have Unix privileges to do so). Robot Happy 


Have you considered running your program via command line? 

Ask a Question
Discussion stats
  • 1 reply
  • 2 in conversation