As with regular Minitab commands, subcommands of macros are optional-when invoking the macro, you can choose whether or not to type the subcommand. You can structure your macro to respond differently depending on whether or not a subcommand was used.
Each subcommand listed on the template is an implicit constant, which means that it is automatically created and does not have to be declared. This is why there is a rule against declaring a variable with the same name as a subcommand.
If the macro is invoked using the optional subcommand, Minitab sets the subcommand constant to 1; if the subcommand was not used, Minitab sets the subcommand constant to 0.
If you type the PERCENT subcommand while invoking the macro below, Minitab sets the variable subcommand constant equal to 1, thereby leaving the percent value up to you. If you do not type PERCENT, the variable subcommand constant defaults to 0, thereby accepting the percent value. The NOTE command after the "IF PERCENT = 0" statement tells the user when the macro is using the default trim size of 5 percent.
MACRO
TRIM2 X XBAR;
PERCENT PCT;
MCONSTANT N T1 T2 XBAR PCT
MCOLUMN X XSORT XTRIM
DEFAULT PCT = 5
body of the macro
IF PERCENT = 0
NOTE Trimming 5 percent from each end
ENDIF
ENDMACRO