PROC OPTIONS
GROUP=
MACRO
Type: System option
Default: NOMFILE
Requirement: MPRINT option
See: “MPRINT System Option” on page 375
Syntax
MFILE | NOMFILE
Required Arguments
MFILE
routes output produced by the MPRINT option to an external file. This option is
useful for debugging.
NOMFILE
does not route MPRINT output to an external file.
Details
The MPRINT option must also be in effect to use MFILE, and an external file must be
assigned the fileref MPrint. Macro-generated code that is displayed by the MPRINT
option in the SAS log during macro execution is written to the external file referenced by
the fileref MPrint.
If MPrint is not assigned as a fileref or if the file cannot be accessed, warnings are
written to the SAS log and MFILE is set to off. To use the feature again, you must
specify MFILE again and assign the fileref MPrint to a file that can be accessed.
MINDELIMITER= System Option
Specifies the character to be used as the delimiter for the macro IN operator.
Valid in: Configuration file, OPTIONS window, OPTIONS statement, SAS invocation
Category: Macro
PROC OPTIONS
GROUP=
MACRO
Type: System option
Default: a blank
Restriction: The following characters cannot be used as a delimiter
% & ' " ( ) ;
See: “MINOPERATOR System Option” on page 371 and “%MACRO Statement” on page
325
Syntax
MINDELIMITER="option"
MINDELIMITER= System Option 369
Required Argument
option
is a character enclosed in double or single quotation marks. The character will be
used as the delimiter for the macro IN operator. Here is an example:
double quotation marks
mindelimiter=”,”;
or single quotation marks
mindelimiter=',';
Restriction
The following characters cannot be used as a delimiter
% & ' " ( ) ;
Details
The option value is retained in original case and can have a maximum length of one
character. The default value of the MINDELIMITER option is a blank.
You can use the # character instead of IN.
Note: When the IN or # operator is used in a macro, the delimiter that is used at the
execution time of the macro is the value of the MINDELIMITER option at the time
of the compilation of the macro. A specific delimiter value for use during the
execution of the macro other than the current value of the MINDELIMITER system
option might be specified on the macro definition statement:
%macro macroname / mindelimiter=',';
The following is an example using a specified delimiter in an IN operator:
%put %eval(a in d,e,f,a,b,c); /* should print 0 */
%put %eval(a in d e f a b c); /* should print 1 */
option mindelimiter=',';
%put %eval(a in d,e,f,a,b,c); /* should print 1 */
%put %eval(a in d e f a b c); /* should print 0 */
The following is the output to the SAS log:
NOTE: Copyright (c) 2002-2012 by SAS Institute Inc., Cary, NC, USA.
NOTE: SAS (r) Proprietary Software 9.4 (TS1B0)
Licensed to SAS Institute Inc., Site 1.
NOTE: This session is executing on the W32_7PRO platform.
NOTE: SAS initialization used:
real time 1.02 seconds
cpu time 0.63 seconds
%put %eval(a in d,e,f,a,b,c); /* should print 0 */
0
%put %eval(a in d e f a b c); /* should print 1 */
1
option mindelimiter=',';
%put %eval(a in d,e,f,a,b,c); /* should print 1 */
1
%put %eval(a in d e f a b c); /* should print 0 */
0
370 Chapter 20 System Options for Macros
MINOPERATOR System Option
Controls whether the macro processor recognizes and evaluates the IN (#) logical operator.
Valid in: Configuration file, OPTIONS window, OPTIONS statement, SAS invocation
Category: Macro
PROC OPTIONS
GROUP=
MACRO
Type: System option
Default: NOMINOPERATOR
Note: In order to use the macro IN operator in an expression, you must ensure that the
MINOPERATOR system option has been changed from its default value of
NOMINOPERATOR to MINOPERATOR. For more information, see MINOPERATOR
system option on page 371 and “%MACRO Statement” on page 325.
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” on page 369.
MINOPERATOR System Option 371
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);
For more information, see “Defining Arithmetic and Logical Expressions” on page 74.
MLOGIC System Option
Specifies whether the macro processor traces its execution for debugging.
Valid in: Configuration file, OPTIONS window, OPTIONS statement, SAS invocation
Category: Macro
PROC OPTIONS
GROUP=
MACRO
LOGCONTROL
Type: System option
Default: NOMLOGIC
See: “The SAS Log” in SAS Language Reference: Concepts
Syntax
MLOGIC | NOMLOGIC
Required Arguments
MLOGIC
causes the macro processor to trace its execution and to write the trace information to
the SAS log. This option is a useful debugging tool.
NOMLOGIC
does not trace execution. Use this option unless you are debugging macros.
Details
Use MLOGIC to debug macros. Each line generated by the MLOGIC option is
identified with the prefix MLOGIC(macro-name):. If MLOGIC is in effect and the
macro processor encounters a macro invocation, the macro processor displays messages
that identify the following:
the beginning of macro execution
values of macro parameters at invocation
372 Chapter 20 System Options for Macros
execution of each macro program statement
whether each %IF condition is true or false
the ending of macro execution
Note: Using MLOGIC can produce a great deal of output.
For more information about macro debugging, see Chapter 10, “Macro Facility Error
Messages and Debugging,” on page 121.
Example: Tracing Macro Execution
In this example, MLOGIC traces the execution of the macros MKTITLE and
RUNPLOT:
%macro mktitle(proc,data);
title "%upcase(&proc) of %upcase(&data)";
%mend mktitle;
%macro runplot(ds);
%if %sysprod(graph)=1 %then
%do;
%mktitle (gplot,&ds)
proc gplot data=&ds;
plot style*price
/ haxis=0 to 150000 by 50000;
run;
quit;
%end;
%else
%do;
%mktitle (plot,&ds)
proc plot data=&ds;
plot style*price;
run;
quit;
%end;
%mend runplot;
options mlogic;
%runplot(Sasuser.Houses)
When this program executes, this MLOGIC output is written to the SAS log:
MLOGIC(RUNPLOT): Beginning execution.
MLOGIC(RUNPLOT): Parameter DS has value sasuser.houses
MLOGIC(RUNPLOT): %IF condition %sysprod(graph)=1 is TRUE
MLOGIC(MKTITLE): Beginning execution.
MLOGIC(MKTITLE): Parameter PROC has value gplot
MLOGIC(MKTITLE): Parameter DATA has value sasuser.houses
MLOGIC(MKTITLE): Ending execution.
MLOGIC(RUNPLOT): Ending execution.
MLOGICNEST System Option
Specifies whether to display the macro nesting information in the MLOGIC output in the SAS log.
Valid in: Configuration file, OPTIONS window, OPTIONS statement, SAS invocation
MLOGICNEST System Option 373
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset