MINOPERATOR System Option

Controls whether the macro processor recognizes and evaluates the IN (#) logical operator.
Valid in: Configuration fileOPTIONS windowOPTIONS statementSAS invocation
PROC OPTIONS GROUP= MACRO
Type: System option
Default: NOMINOPERATOR

Syntax

MINOPERATOR | NOMINOPERATOR

Required Arguments

MINOPERATOR
causes the macro processor to recognize and evaluate both the mnemonic operator IN or the special character # as a logical operator in expressions.
NOMINOPERATOR
causes the macro processor to recognize both the mnemonic operator IN and the special character # as regular characters.

Details

Use the MINOPERATOR system option or in the %MACRO statement if you want to use the IN (#) as operators in expressions:
options minoperator;
To use IN or # as operators in expressions evaluated during the execution of a specific macro, use the MINOPERATOR keyword on the definition of the macro:
%macro macroname / minoperator;
The macro IN operator is similar to the DATA step IN operator, but not identical. The following is a list of differences:
  • The macro IN operator cannot search a numeric array.
  • The macro IN operator cannot search a character array.
  • A colon (:) is not recognized as a shorthand notation to specify a range, such as 1:10 means 1 through 10. Instead, you use the following in a macro:
    %eval(3 in 1 2 3 4 5 6 7 8 9 10);
  • The default delimiter for list elements is a blank. For more information, see MINDELIMITER= System Option.
  • Both operands must contain a value.
    %put %eval(a IN a b c d); /*Both operands are present. */
    If an operand contains a null value, an error is generated.
    %put %eval(  IN a b c d); /*Missing first operand. */
    or
    %put %eval(a IN); /*Missing second operand. */
    Whether the first or second operand contains a null value, the same error is written to the SAS log:
    ERROR: Operand missing for IN operator in argument to %EVAL function.
The following example uses the macro IN operator to search a character string:
%if &state in (NY NJ PA) %then %let &region = %eval(&region + 1);