BookmarkSubscribeRSS Feed
tonkasas1
Calcite | Level 5

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?

Thanks!

2 REPLIES 2
hbi
Quartz | Level 8 hbi
Quartz | Level 8

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.). 

 

sastemp.gif

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? 

mmohotsi
Obsidian | Level 7
I am also interested in the solution for this question.

In my case, I use a desktop license and wish to write a command line at the end of the SAS program to completely shutdown SAS from EG. This will help me because I have a SAS program that I have scheduled for three distinct times a day. During the first session, the SAS program opens and executes successfully. For the second session, when the program opens it requires my attention to accept that it will not be saved since the same program is still opened. So, I need to completely close the first session so that when the next sessions opens, it should not find the first one available.
I have used the
%macro runquit;
%abort ;
%mend runquit;
but it does not help.


sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

How to Concatenate Values

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 4936 views
  • 0 likes
  • 3 in conversation