Previous Page | Next Page

Statements

GO TO Statement



Directs program execution immediately to the statement label that is specified and, if followed by a RETURN statement, returns execution to the beginning of the DATA step.
Valid: in a DATA step
Category: Control
Type: Executable
Alias: GOTO

Syntax
Arguments
Comparisons
Examples
See Also

Syntax

GO TO label;


Arguments

label

specifies a statement label that identifies the GO TO destination. The destination must be within the same DATA step. You must specify the label argument.


Comparisons

The GO TO statement and the LINK statement are similar. However, a GO TO statement is often used without a RETURN statement, whereas a LINK statement is usually used with an explicit RETURN statement. The action of a subsequent RETURN statement differs between the GO TO and LINK statements. A RETURN statement after a LINK statement returns execution to the statement that follows the LINK statement. A RETURN after a GO TO statement returns execution to the beginning of the DATA step (unless a LINK statement precedes the GO TO statement. In that case, execution continues with the first statement after the LINK statement).

GO TO statements can often be replaced by DO-END and IF-THEN/ELSE programming logic.


Examples

Use the GO TO statement as shown here.


See Also

Statements:

DO Statement

Labels, Statement

LINK Statement

RETURN Statement

Previous Page | Next Page | Top of Page