Local macros are created in the same way as global macros, using a text editor or various features of Minitab. See Global Macro Example. However, the structure and the contents of a local macro can differ significantly.
The structure of a local macro is similar to that of a global macro, but it includes additional elements that allow you to define the syntax of the user command, and to declare variables for the local worksheet. The contents of a local macro follow this structure:
MACRO
template
declaration statements
body of the macro
ENDMACRO
MACRO and ENDMACRO mark the beginning and end of each macro. You can have more than one macro within a local macro file-see Invoking Macros from within Macros. MACRO must be the first line of your macro because it labels the macro type as local, not global. MACRO and ENDMACRO can not be abbreviated.
The template gives the macro command name and any subcommands, as well as any undetermined arguments. See Writing a Template.
Each variable that will be used in the macro must be "declared" with a declaration statement. Declaring a variable tells the local macro what type of variable to expect when the macro is invoked: a column, constant, or matrix. See Declaration Statements.
The body of a macro consists of command language that controls the automatic data processing. The language includes: