%LIST Statement

Displays lines that are entered in the current session.
Valid in: Anywhere
Category: Program Control

Syntax

%LIST<n <:m | − m> >;

Without Arguments

In interactive line mode processing, if you use the %LIST statement without arguments, it displays all previously entered program lines.

Arguments

n
displays line n.
n–m
displays lines n through m.
Alias:n:m

Details

Where and When to Use

The %LIST statement can be used anywhere in a SAS job except between a DATALINES or DATALINES4 statement and the matching semicolon (;) or semicolons (;;;;). This statement is useful mainly in interactive line mode sessions to display SAS program code on the monitor. It is also useful to determine lines to include when you use the %INCLUDE statement.

Interactions

CAUTION:
In all modes of execution, the SPOOL system option controls whether SAS statements are saved.
When the SPOOL system option is in effect in interactive line mode, all SAS statements and data lines are saved automatically when they are submitted. You can display them by using the %LIST statement. When NOSPOOL is in effect, %LIST cannot display previous lines.

Example: Displaying Lines That Are Entered in the Current Session

This %LIST statement displays lines 10 through 20:
   %list 10-20;

See Also

Statements:
System Options:
SPOOL System Option in SAS System Options: Reference