System Options for Macros |
Valid in: |
| ||||
Type: | System option | ||||
Default: | NOMINOPERATOR | ||||
PROC OPTIONS GROUP= | MACRO |
Syntax | |
Details |
Syntax |
MINOPERATOR | NOMINOPERATOR |
causes the macro processor to recognize and evaluate both the mnemonic operator IN or the special character # as a logical operator in expressions.
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.
%if &state in (NY NJ PA) %then %let ®ion = %eval(®ion + 1);
For more information, see Defining Arithmetic and Logical Expressions.
Copyright © 2009 by SAS Institute Inc., Cary, NC, USA. All rights reserved.