Chapter Contents

Previous

Next
%label

%label



Identifies the destination of a %GOTO statement

Type: Macro statement
Restriction: Allowed in macro definitions only
See also: %GOTO


Syntax
Details
Example
Controlling Program Flow

Syntax

%label: macro-text

label
specifies a SAS name.

macro-text
is a macro statement, a text expression, or constant text. The following examples illustrate each:


Details


Example

Example 1: Controlling Program Flow

In the macro INFO, the %GOTO statement causes execution to jump to the label QUICK when the macro is invoked with the value of short for the parameter TYPE.

%macro info(type);
   %if %upcase(&type)=SHORT %then %goto quick; /* No % here */
      proc contents;
      run;
      proc freq;
         tables _numeric_;
      run;
   %quick: proc print data=_last_(obs=10);     /* Use % here */
      run;
%mend info;

%info(short)

Invoking the macro INFO with TYPE equal to short generates these statements:

PROC PRINT DATA=_LAST_(OBS=10);
   RUN;


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.