A macro is a text file that contains a series of Minitab session commands. You can use macros to automate a repetitive task (for example, generating a monthly report) or to extend Minitab's functionality (for example, computing a special test statistic).
You can run macros in both the desktop and web apps versions of Minitab Statistical Software.
GMACRO
NOMISS
LET K90 = COUNT('X')
DO K91 = 1:K90
IF 'X'[K91] = '*'
DELETE K91:K90 'X'
BREAK
ENDIF
ENDDO
ENDMACRO
This macro (NOMISS) looks for the first missing observation in a column named X, then deletes the remainder of the column.
MACRO
MNSTD x y z
MCOLUMN x y z v
MCONSTANT N i k1 k2
MRESET
BRIEF 0
LET N=count(x)
LET y(1)='*'
LET z(1)='*'
DO i=2:N
COPY x v;
USE 1:i.
LET y(i)= MEAN(v)
LET z(i)= STDEV(v)
ENDDO
ENDMACRO
This macro (MNSTD) calculates the mean and standard deviation for the first two rows of a column, then the first three rows, and so on.
HISTOGRAM C1 C2;
YFrequency;
Bar;
Panel.
For example, create an exec to recreate a graph you made earlier in your Minitab session. This exec draws a histogram of frequency for two columns and panels them.
The easiest way to create an Exec file is to save command language from the History pane.
The following steps will save all the commands in the History pane. If you have just a few lines that you want to save from the History pane, highlight them, and copy and paste into a text editor, such as Notepad, then save the file using a .mtb file extension.
To run an Exec, you could also drag and drop the Exec file on a Minitab shortcut.
Yes. The COLUMNS subcommand is required in local macros. COLUMNS specifies which columns of the Minitab worksheet should hold the data. In global macros or exec files, executing the ODBC command without the COLUMNS subcommand places new data at the end of the global worksheet.