Previous Page | Next Page

Macro Statements

%label Statement



Identifies the destination of a %GOTO statement.
Type: Macro statement
Restriction: Allowed in macro definitions only
See also: %GOTO Statement

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:

  •  %one: %let book=elementary;
  • %out: %mend;
  •  %final: data _null_;

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;

Previous Page | Next Page | Top of Page