%label Statement
Identifies the destination of a %GOTO statement.
Type: |
Macro statement |
Restriction: |
Allowed in macro definitions only |
See: |
%GOTO Statement |
Syntax
Required Arguments
- 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;
-
-
Details
-
The label name is preceded by a
%. When you specify this label in a %GOTO statement, do not precede
it with a %.
-
An alternative to using the %GOTO
statement and statement label is to use a %IF-%THEN statement with
a %DO group.
Example: 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;