%SUPERQ Function

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

Syntax

%SUPERQ (argument)

Required 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.

Comparisons

  • %SUPERQ is the only quoting function that prevents the resolution of macro variables and macro references in the value of the specified macro variable.
  • %SUPERQ accepts only the name of a macro variable as its argument, without an ampersand, while the other quoting functions accept any text expression, including constant text, as an argument.
  • %SUPERQ masks the same characters as the %NRBQUOTE function. However, %SUPERQ does not attempt to resolve anything in the value of a macro variable. %NRBQUOTE attempts to resolve any macro references or macro variable values in the argument before masking the result.

Example: 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.