Previous Page | Next Page

Macro Functions

%SUPERQ Function



Masks all special characters and mnemonic operators at macro execution but prevents further resolution of the value.
Type: Macro quoting function
See also:

%NRBQUOTE Function

%BQUOTE and %NRBQUOTE Functions


Syntax
Details
Comparisons
Example
Passing Unresolved Macro Variable Values

Syntax

%SUPERQ (argument)

argument

is the name of a macro variable with no leading ampersand or a text expression that produces the name of a macro variable with no leading ampersand.


Details

The %SUPERQ function returns the value of a macro variable without attempting to resolve any macros or macro variable references in the value. %SUPERQ masks the following special characters and mnemonic operators:

& % ' " ( ) + - * / < > = ¬ ^ ~ ; , #  blank
AND OR NOT EQ NE LE LT GE GT IN

%SUPERQ is particularly useful for masking macro variables that might contain an ampersand or a percent sign when they are used with the %INPUT or %WINDOW statement, or the SYMPUT routine.

For a description of quoting in SAS macro language, see Macro Quoting.

Note:   The maximum level of nesting for the macro quoting functions is 10.  [cautionend]


Comparisons


Example


Example 1: Passing Unresolved Macro Variable Values

In this example, %SUPERQ prevents the macro processor from attempting to resolve macro references in the values of MV1 and MV2 before assigning them to macro variables TESTMV1 and TESTMV2.

data _null_;
   call symput('mv1','Smith&Jones');
   call symput('mv2','%macro abc;');
run;

%let testmv1=%superq(mv1);
%let testmv2=%superq(mv2);

%put Macro variable TESTMV1 is &testmv1;
%put Macro variable TESTMV2 is &testmv2;

When this program executes, these lines are written to the SAS log:

Macro variable TESTMV1 is Smith&Jones
Macro variable TESTMV2 is %macro abc;

You might think of the values of TESTMV1 and TESTMV2 as "pictures" of the original values of MV1 and MV2. The %PUT statement then writes the pictures in its text. The macro processor does not attempt resolution. It does not issue a warning message for the unresolved reference &JONES or an error message for beginning a macro definition inside a %LET statement.

Previous Page | Next Page | Top of Page