Previous Page | Next Page

Getting Started with SAS in UNIX Environments

Ending a SAS Process on a Relational Database


How to Interrupt a SAS Process

CAUTION:
When you interrupt a SAS process, you might terminate the current query.

If you are using the current query to create a new data set, then the data set is still created even if the query is terminated. If you are using the current query to overwrite a data set, the data set is not overwritten if the query is terminated. In most cases you do not receive a warning that the query did not complete.  [cautionend]

The method that you use to interrupt a SAS process depends on how you invoke SAS.

The interrupt signal is sent to the host supervisor. The supervisor determines which DATA steps or procedures are running, and gives you options to interrupt these DATA steps or procedures. The actions that you can take appear in the interrupt menu. After you select an action, the host supervisor performs the operation you selected. Because the options in the interrupt menu are dependent on what is currently executing, you might see a different interrupt menu for the following:

Note:   Depending on the relational database, the interrupt signal might be handled differently. The interrupt signal is not handled until a safe point in the code is reached that allows the interrupt handler to be run safely.  [cautionend]


Example: Interrupt Menu for PROC SQL

The following is an example of the interrupt menu that you might see if you issue an interrupt signal while SAS is processing a PROC SQL statement:

Select:
      1. Cancel Submitted Statements
      2. Halt Datastep/Proc: SQL
      C. Cancel the dialog
      T. Terminate the SAS System

The following table explains each of these options:

Description of Interrupt Menu Options for PROC SQL
Option Description What This Option Does
1 Cancel Submitted Statements Selecting this option will end the current DATA step or procedure and the underlying DBMS process. Outstanding source code that is waiting to execute will be flushed from the system. In interactive mode, you will return to the command prompt.
2 Halt Datastep/Proc: SQL If you select this option and SAS is currently executing an SQL procedure, then the following menu appears:
Press:
      C to continue
      Q to cancel the current query
      S to cancel the submitted statements
      X to exit SQL procedure
      ?

  • If you select C , then the menu will disappear, but because the current query ended when you interrupted the SAS process, SAS will not return to the current query. Instead, SAS will begin processing the next line of code.

  • If you select Q , then SAS cancels the current query even if it is on a relational database. SAS continues processing the next statement.

  • If you select S , then all of the PROC SQL statements that you submitted are canceled.

  • If you select X , SAS exits the current SQL procedure and starts processing the next statement in the submit block.

C Cancel the dialog Selecting this option returns you to normal processing; however, the current query might have been interrupted. If you are running a long query and the control is on the DBMS server, then selecting C will end the current query. If you are running a short query and SAS has the control, then selecting C will cause the interrupt menu to disappear and the current query will continue. To determine whether the query was interrupted while reading or writing out the DBMS data, use PROC PRINT to view the partially created DBMS table or SAS data set.
T Terminate SAS Selecting this option ends your SAS session as well as the current query.


How to Terminate a SAS Process

The method that you use to terminate a SAS process depends on how you invoke SAS.

If you click Terminate in the SAS Session Manager, then a dialog box appears confirming that you want to end the session. If you click OK, then both the SAS session and the current query are terminated. If you click Cancel, then you are returned to the SAS session.


What Happens When You Interrupt a SAS Process and the Underlying DBMS Process

CAUTION:
Interrupting a SAS process and the underlying DBMS process might kill all jobs that are running on your DBMS.

Interrupting your SAS and DBMS processes should be an exception. Extensive care should be taken when you construct your queries.

If SAS sends SQL to an RDBMS, there is no way to interrupt the SQL statements because SAS no longer has control of them. The statements are running in the RDBMS.  [cautionend]

Note:   In this section, SAS process refers to a series of events. It is not the process on the operating system. When you interrupt or terminate a SAS process, the process on the operating system might still be running.  [cautionend]

When you interrupt or terminate a query on a server, the following processes stop:

Previous Page | Next Page | Top of Page