The macros at this site were written for MINITAB 13. Updated versions of some of them and more macros for V14 can be found at

How to Write Minitab Exec Macros (An Introduction to Minitab Macros )

PGMathews, January 6, 1999 Rev 1.3

Abstract: Minitab supports three different types of macros. The simplest of them, the exec macro, is described and instructions for writing and running exec macros are given. An example problem and solution is presented.

Key Words: Minitab, macro, exec, global, local, program

Transfer the file: (To view this file you need the Scientific Notebook Viewer. Get a free copy of the viewer from )

 These macros

Already Written Minitab Macros ( Macros, Descriptions, and Directions are found below )

January 26, 2002

A catalog of macros and directions on how to use them is found below. Many of these macros are unique because of the graphic output they produce. As time permits, thumbnails of the graphic output will be posted. An example of the output of the hypothesis test plot for the OneT.mac is here. Click here or on thumbnail to view a larger image of the hypothesis test plot.

Minitab Macro Library

Mathews and Malnar, Statistical Trainers and Consultants

217 Third Street, Fairport Harbor, OH 44077



Macros may contain errors and/or give erroneous results. Mathews and Malnar are not responsible for the use or misuse of these macros. Use at your own risk.


Macros are local (.mac) unless indicated otherwise. Macros are written for Minitab V13 although they may run on earlier versions. Some features in certain macros are incomplete. Download macros from


You should install these macros in Minitabís macro subdirectory, for example, in c:\Program Files\Mtbwin\Macros. If you put them in another directory you will have to use a change directory command (for example: mtb> cd a:) to tell Minitab where to find the macro.


Instructions for running macros with example calling statements are included in the comments at the beginning of each macro. Open the macros with Notepad to view the contents. Notepadís default is to look for .txt files so you will have to set Files of Type: to All Types to find .mac and .mtb files. Be careful editing macros with Word or Wordpad. They often embed hidden formatting in files that Minitab cannot interpret. Definitely donít use Word or Wordpad if your Windows system uses a non-English character set.


If you edit or rename a macro your Windows operating system will probably append a .txt extension to a .mac or .mtb macro, such as normal.mac.txt. This will prevent Minitab from easily finding and accessing .mac and .mtb macros. To prevent this you should register the .mac file type with Windows by:

  1. In My Computer or Windows Explorer, on the View menu, click Folder Options.
  2. Click the File Types tab, then click New Type.
  3. In Description of Type, type Minitab Exec Macro.
  4. In Associated Extension, type mtb without a leading period.
  5. Click New and in New Action type Open.
  6. In Application Used to Perform Action, click Browse and find notepad.exe. Double click the file, then click OK. This will cause a macro to open in Notepad when you double click it in My Computer or Windows Explorer.
  7. In Add New File Type, click Close.
  8. In the File Type Details window confirm that Extension is mtb and Opens With: is Notepad. Click Close.

Repeat the process for .mtb file types.


There are two ways to run .mac macros from Minitab:

  1. If you do not have the Session window command prompt (mtb> ) enabled you can submit commands by selecting Edit> Command Line Editor.
  2. You can enable the command prompt in the Session window by clicking anywhere in the Session window, then selecting Editor> Enable Commands. The Minitab command prompt mtb> will appear in the Session window.
  3. If you always want the command prompt to appear in the Session window you can make it the default choice when Minitab starts by going to Edit> Preferences> Session Window> Command Language and selecting Enable. While youíre in this window you should change the Prompt Color to something that stands out, like red, so that you can easily find the command prompt at the bottom of the Session Window.
  4. You must append the % operator to a macro name to invoke it. For example, to run the onet.mac macro which performs a one-sample t test for the mean and plots the result, if sample data are in column c1 and we want to test to see if they are consistent with the claim Ho: m =80, we can invoke the macro with:

mtb> %onet c1;

subc> test 80.


To run a .mtb macro select the macro with Files> Other Files> Run an Exec or invoke the macro from the command prompt with the exec command followed by the macro name in single quotes:

mtb> exec Ďnormprací


Macros may contain errors and/or give erroneous results. Mathews and Malnar are not responsible for the use or misuse of these macros. Use at your own risk.

When you click a link below you should save the file to the Minitab Macros directory, like c:\Program Files\Mtbwin\Macros.

Name Description

beta Calculates the complete beta function.

binomial Calculates binomial probability.

boxslip .mtb Simulation macro for two sample locations test.

ciforp Finds and plots 95% confidence interval for cumulative fraction defective.

circnorm Constructs a probability plot for circular normal data.

defectivesOC Calculates and plots the OC curve for SSP for defectives

fcdf Calculates right tail probability for the F distribution.

finv Calculates the F value for a specified right tail area of the F distribution.

fishers Calculates the one-tailed p value for Fisherís exact method.

fishersV12 Calculates the approximate one-tailed p value for Fisherís exact method for V12.

fisherspower Finds exact power for one-sided Fisherís exact test.

fishersim Finds power for Fisherís exact test by simulation. Use fisherspower instead.

fnoncent Calculates the noncentral F distribution probability

ftest Performs F test and then creates hypothesis test plot of results.

gelgrrsim GRR simulation for GEL LTC course.

grrsim GRR simulation macro for DOE.

halfnorm Constructs a probability plot for half normal data.

hypergeometric Calculates hypergeometric probability.

incbeta Calculates the incomplete beta function used for t and F distributions.

lognormalpaper Creates blank log by normal probability paper for manual plotting.

normal Calculates the left tail probability for the normal distribution.

normalpaper Creates blank normal probability paper for manual plotting.

normprac.mtb Simulation macro to practice interpretation of normal probability plots.

occurve Creates OC curve for conditions determined in TwoSamplepSize.

onet Performs t test and then creates hypothesis test plot of result. Sample plot is below. Click on image for a larger view.

plotnorm Constructs a probability plot of normal data.

poisson Calculates Poisson probability.

power Calculates F test power for balanced fixed effects ANOVA.

quadinterp Performs quadratic interpolation from three reference points.

randomizeit Randomizes the order of specified columns.

resampletwo Uses resampling method to perform two sample test for location.

runchart.mtb Creates blank run chart form for manual plotting.

runningsum Calculates the running sum of a column.

sim3 3 variable simulation for DOE.

sim5 5 variable simulation for DOE.

sixdice Magic dice simulation for DOE.

studentst Calculates probability for Studentís t distribution

threenorms Creates normal, half normal, and circular normal plots on one graph.

TwoSamplepSize Finds smallest n and dx for two sample test of fractions defective.

unrandomizeit Unrandomizes the order of specified columns.

zinvcdf Finds the inverse normal probability (zp for specified p)

ztest Performs z test and then creates hypothesis test plot of result.


Blank Forms:

Normal.mgf Normal probability paper created with normalpaper.mac.

2 cycle lognormal.mgf 2 cycle log by normal probability paper

3 cycle lognormal.mgf 3 cycle log by normal probability paper

runchart.mgf Run chart form created with runchart.mtb.


Last Revised: 02/24/2002. Counter started on 01/19/02.