Global Macro Structure
    

A macro consists of lines of text, which represent command language, stored in a text file. While all macros follow a similar structure, global macros follow this specific structure:

GMACRO
template

body of the macro

ENDMACRO

GMACRO and ENDMACRO

These commands mark the beginning and end of each global macro. GMACRO must be the first line of your macro because it labels the macro type as global, not local. ENDMACRO ends the macro command. GMACRO and ENDMACRO, as well as all macro commands, cannot be abbreviated.

Template

The term "template" is used much differently when discussing global macros than when discussing local macros. Global macros simply use a "template" to name the group of commands for the macro. Local macros use a "template" to store the most repetitive commands, subcommands, and corresponding arguments.

You type the name of the template for your global macro starting with a letter. The remaining characters in the name can contain letters, numbers, or the underscore character. The template name can be upper, lower, or mixed case; Minitab ignores case when you invoke the macro. Using the macro file name as your template name is probably most convenient, but not required. For example, all of the following are valid combinations of templates and file names.

Template

File name

Invoked by

MyMacro

MYMACRO.MAC

%MYMACRO

Analyze

TEST.MAC

%TEST

Analyze2

TEST2.TXT

%TEST2.TXT

Body of the macro

The body of a macro consists of command language that controls the automatic data processing. The language includes:

Minitab commands

Control statements

Macro statements (such as IF, THEN, PAUSE, CALL and GOTO)

Invocation of other global macros