SAS Institute. The Power to Know

SAS/IML(R) 9.2 User's Guide

Previous | Next
Programming Statements

PAUSE Statement

The general form of the PAUSE statement is as follows:

PAUSE < message > < * > ;

The PAUSE statement does the following:

  • stops execution of the module
  • remembers where it stopped executing
  • prints a pause message that you can specify
  • puts you in immediate mode within the module environment. This mode uses the module's local symbol table. At this point you can enter more statements.

A RESUME statement enables you to continue execution at the place where the most recent PAUSE statement was executed.

You can use a STOP statement as an alternative to the RESUME statement to remove the paused states and return to the immediate environment outside the module.

You can specify a message in the PAUSE statement to display a message as the pause prompt. If no message is specified, IML displays the following default message:

  
    paused in module \ob XXX\obe
 

where XXX is the name of the module containing the pause. To suppress the display of any messages, use the * option, as follows:

  
    pause *;
 

The following are examples of PAUSE statements with operands:

  
    pause "Please enter an assignment for X, then enter RESUME;"; 
  
    msg ="Please enter an assignment for X, then enter RESUME;"; 
    pause msg;
 

When you use the PAUSE, RESUME, STOP, or ABORT statement, you should be aware of the following details:

  • The PAUSE statement can be issued only from within a module.
  • IML diagnoses an error if you execute a RESUME statement without any outstanding pauses.
  • You can define and execute modules while paused from other modules.
  • A PAUSE statement is automatically issued if an error occurs while statements are being executed inside a module. This gives you an opportunity to correct the error and resume execution of the module with a RESUME statement. Alternately, you can submit a STOP or ABORT statement to exit from the module environment.
  • You cannot reenter or redefine an active (paused) module; you will get an error for recursive module execution.
  • In paused mode, you can run another module that, in turn, pauses; the paused environments are stacked.
  • You can put a RESUME statement inside a module. For example, suppose you are paused in module A and then run module B, which executes a RESUME statement. Execution is resumed in module A and does not return to module B.
  • IML supports stopping execution while in a paused state in both subroutine and function modules.
  • If you pause in a subroutine module that has its own symbol table, then the immediate mode during the pause uses this symbol table rather than the global one. You must use a RESUME or a STOP statement to return to the global symbol table environment.
  • You can use the PAUSE and RESUME statements, in conjunction with the PUSH, QUEUE, and EXECUTE subroutines described in Chapter 15, to execute IML statements that you generate within a module.
Previous | Next | Top of Page