Macro Commands by Function
     

In addition to all of the Session commands, macros also have exclusive commands that assist in processing the macro.

Structure Commands

GMACRO  command that initiates global macro structure

MACRO  command that initiates local macro structure

ENDMACRO  command that ends the macro structure

Declaration Statements

MCONSTANT  list of variables that are declared as constants

MCOLUMN  list of variables that are declared as columns

MMATRIX  list of variables that are declared as matrices

MTYPE  variablename K (local macros only: if variable is a constant returns K = 1; if a column K = 2; if a matrix K = 3)

MFREE  list of variables that are determined when macro executed

DEFAULT  argument=value... argument=value

Local Macro Variables

KKCAT  K K K (combine the text in the first two K's, store combined text in the third K; all K's are text constants)

KKNAME  K C, K C, ... (store the text constant K in column C)

KKSET  K "text", K "text", ... (store the text in the text constant K)

DTYPE  E K returns the data type of a column or constant

Control Statements

IF  logical expression (same as for LET)

ELSEIF  logical expression

ELSE  logical expression

ENDIF  logical expression

DO  K = list of numbers

ENDDO  logical expression

WHILE  logical expression

ENDWHILE  logical expression

NEXT  transfers control to beginning of DO or WHILE loop

BREAK  goes to the command that follows a DO or WHILE loop

GOTO  number

MLABEL  number

CALL  template (calls a subroutine in the same file)

RETURN  ends subroutine and returns control to main macro

EXIT  stop macro, return to Minitab session

PAUSE  transfers control from macro to keyboard

RESUME  returns control to the macro

Using DOS Commands

CD  [path] change folder

DIR  [path] list file names

TYPE  "[ path] filename. ext" displays a file

Labeling Macro Output

MTITLE  "title" (displays a custom title above output in Session window)

TITLE  (default; displays output titles in Session window)

NOTITLE  suppress output titles in Session window

WTITLE  "title" for Graph window

Debugging Tools

ECHO  displays macro commands in Session window during execution

NOECHO  (default)

DEBUG  tells how the macro is processing

NODEBUG  (default)

TYPE  "[ path] filename. ext" displays a file

PAUSE  transfers control from macro to keyboard

RESUME  transfers control from keyboard back to macro

Handling Errors

PLUG  macro keeps going when it finds an error

NOPLUG  (default)

MRESET  restore environment settings after macro runs

INFO  displays summary of local worksheet

Additional Local Macro Features

WRITE  can be used to store local worksheet columns or constants in a text file

INFO  displays summary of local worksheet

Commands that Affect Output

BRIEF  = K controls amount of output from several stat commands

OH  K (default = 0; controls pausing of output in Session window)

GPAUSE  [K]

GSAVE

GPRINT  with no arguments prints the newest Graph window

GSCALE  K = minimum data value K = maximum data value

NOBRUSH  disable brushing on the resulting graph with any graphics command

Communicating with Macro Users

READ  file

SET  file

INSERT  file

YESNO  K (returns K = 1 if user responds "Yes", K = 0 for "No")

PAUSE  transfers control from macro to keyboard

RESUME  transfers control from keyboard back to macro

NOTE  [comment] (displays blank lines or messages)

Execs Commands

EXECUTE  [" filename"] [K times] (default filename = Minitab. MTB)

ECHO  display the commands that follow

NOECHO  do not display the commands that follow (default)

YESNO  K (returns K = 1 if user responds "Yes", K = 0 for "No")

Caution

Some session commands cannot be used in macros. See Commands Not Allowed in Macros.