As the first step in the decommissioning of the site has been converted to read-only mode.

Here are some tips for How to share your SAS knowledge with your professional network.

RUN statement

From sasCommunity
Jump to: navigation, search

The RUN statement is the last statement in a DATA Step and indicates to SAS that the step is complete and can now be run. The RUN statement can also be used to run many, but not all, Procedure Steps.

This statement may have different implications depending on the way SAS code is being compiled and executed. In interactive mode(s) the preceeeding data step(s) are run immediately. In batch mode(s) the statement serves as a breakpoint in the log, With the data step code being listed before the run statement and log statements that are the result of execution of the preceeding data step being listed after this statement.


There are two forms of the RUN statement

Without arguments

This is the usual form of the statement. It causes the preceeding DATA step or Procedure step to be processed.


Cancel argument

This for causes the preceeding data step(s) to be ignored, and not be run.


This form is usually used in interactive mode(s) where an error in the preceeding data step statements is noticed, as it may not be possible to change the previously entered statements in that mode.


Use of the RUN statement is optional, but recommended good practice. If the RUN statement is not used then the next DATA or PROC statement will behave as if it had been preceeded by a RUN statement. The RUN statement should not be confused with the QUIT statement, which can be used to complete and run Procedure steps. If a QUIT statement is encountered instead of a RUN statement at the end of a DATA step, an error may occur.