Labels, Statement


Identifies a statement that is referred to by another statement

Valid: in a DATA step

Category: Control

Type: Declarative

Syntax

label : statement ;

Arguments

label

  • specifies any SAS name , which is followed by a colon (:). You must specify the label argument.

statement

  • specifies any executable statement, including a null statement (;). You must specify the statement argument.

  • Restriction: No two statements in a DATA step can have the same label.

  • Restriction: If a statement in a DATA step is labeled, it should be referenced by a statement or option in the same step.

  • Tip: A null statement can have a label:

     ABC:; 

Details

The statement label identifies the destination of either a GO TO statement, a LINK statement, the HEADER= option in a FILE statement, or the EOF= option in an INFILE statement.

Comparisons

The LABEL statement assigns a descriptive label to a variable. A statement label identifies a statement or group of statements that are referred to in the same DATA step by another statement, such as a GO TO statement.

Examples

In this example, if Stock=0, the GO TO statement causes SAS to jump to the statement that is labeled reorder. When Stock is not 0, execution continues to the RETURN statement and then returns to the beginning of the DATA step for the next observation.

 data Inventory Order;     input Item $ Stock @;        /* go to label reorder: */     if Stock=0 then go to reorder;     output Inventory;     return;        /* destination of GO TO statement */     reorder: input Supplier $;     put 'ORDER ITEM ' Item 'FROM ' Supplier;     output Order;     datalines;  milk  0 A  bread 3 B  ; 

See Also

Statements:

  • GO TO Statement on page 1210

  • LINK Statement on page 1294

Statement Options:

  • HEADER= option in the FILE statement on page 1159

  • EOF= option in the INFILE statement on page 1224




SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
SAS 9.1 Language Reference Dictionary, Volumes 1, 2 and 3
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 704

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net