Chapter Contents


SAS Companion for UNIX Environments

Interrupting or Terminating Your SAS Session

There are three ways to interrupt or terminate your SAS session:

Enter the kill command.
The kill command sends an interrupt or quit signal to the SAS System, depending on which signal you specify. You can use the kill command to interrupt or terminate a SAS session running in any mode.

Press the interrupt or quit control key.
The control keys send the same signals as the kill command. However, they can be used only when your SAS program is running in interactive line mode or in batch mode in the foreground. You cannot use control keys to stop a batch job that has been submitted with the batch, at, nohup, or cron command.

Use the session manager.
Press the interrupt or terminate buttons in the session manager window. The session manager is available only when you run SAS in the windowing environment.

Using the kill Command

The kill command cannot be issued from within a SAS session. You must issue it from another terminal or from another window (if your terminal permits it).

The format of the kill command is

kill <-signal-name> pid
To send the interrupt signal, specify -SIGINT; to send the quit signal, specify -SIGQUIT. Use the ps command to determine the process identification number (pid) of the SAS session that you want to interrupt or terminate.

For example, suppose you want to stop a SAS job running in the background. First, issue the ps command to determine the PID of the SAS job.

> ps
   2103 ttyu0    0:00 motifxsa
   2111 ttyu0    0:01 sas
   2116 ttyu0    0:00 ps
   3856 ttyu2    0:03 ksh
Four PIDs appear, but only one is for a SAS program. ( motifxsa is the SAS session manager. See Using the SAS Session Manager (motifxsassm) for more information.) Therefore, to send the interrupt signal to that SAS program, you would issue this command:
kill -SIGINT 2111
The SAS System replies with a prompt:
Press Y to cancel submitted statements, 
N to continue.

For more information, refer to the UNIX man pages for the ps and kill commands.

Using Control Keys

Control keys enable you to interrupt or terminate your session by simply pressing the interrupt or quit key sequence. However, control keys can be used only when your SAS program is running in interactive line mode or in batch mode in the foreground. You cannot use control keys to stop a background job.

Because control keys vary from system to system, issue the UNIX stty command to determine which key sends which signal. The stty command varies considerably among UNIX operating environments, so check the stty UNIX man page before using it. Usually, one of these forms of the command will print all of the current terminal settings:

stty -a
stty everything
The output you see should contain lines similar to these:
intr = ^C; quit = ^\; erase = ^H; 
kill = ^U; eof = ^D; eol = ^@

The caret (^) stands for the CTRL key. In this example, control-C is the interrupt key and control-\ is the quit key.

Using the Session Manager

If you invoke SAS in the windowing environment, you can use the session manager to interrupt or terminate your SAS session. The session manager is automatically iconified when you start SAS. To interrupt or terminate your SAS session, open the session manager window and press [Interrupt] or [Terminate].

Chapter Contents



Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.