Previous Page | Next Page

Statements

RETURN Statement



Stops executing statements at the current point in the DATA step and returns to a predetermined point in the step.
Valid: in a DATA step
Category: Control
Type: Executable

Syntax
Without Arguments
Details
Examples
See Also

Syntax

RETURN;


Without Arguments

The RETURN statement causes execution to stop at the current point in the DATA step, and returns control to a previous DATA step statement.


Details

The point to which SAS returns depends on the order in which statements are executed in the DATA step.

The RETURN statement is often used with the

When RETURN causes a return to the beginning of the DATA step, an implicit OUTPUT statement writes the current observation to any new data sets (unless the DATA step contains an explicit OUTPUT statement, or REMOVE or REPLACE statements with MODIFY statements). Every DATA step has an implied RETURN as its last executable statement.


Examples

In this example, when the values of X and Y are the same, SAS executes the RETURN statement and adds the observation to the data set. When the values of X and Y are not equal, SAS executes the remaining statements and then adds the observation to the data set.

data survey;
   input x y;
   if x=y then return;
   put x= y=;
   datalines;
21 25
20 20
7 17
;


See Also

Statements:

FILE Statement

GO TO Statement

LINK Statement

Previous Page | Next Page | Top of Page