Automating Metrics: creating your first macroApr 10th, 2009 by Rick Haynes.
We have talked about the format, now how do get the commands?
Two ways of getting the commands to put into a macro,
1. Copy and paste from the history menu. It can be found with an icon on the tool bar that is yellow with a > in it.
2. From any completed chart/graphic. With the chart open, you go to the editor menu a the top “Editor>Copy Command Language”. This function is not available with a right click.
The graphical summary is one graphic that can only be generated with the menu commands, the copy command language will not work.
Another nice thing to know is that any line in the macro file that has a first character as a (#) will be interpreted as a comment. You can use this to write notes to yourself and identify where different actions are taken in the macro.
Now for an example:
We will create a random normal data set with 25 numbers, make a histogram and an I chart.
If you try it yourself, start with a blank minitab project (just opened minitab) in order to duplicate my information
Make normal data
25 rows, with a column name of data.
Leave a mean of 0 and standard deviation of 1
data variable is data
Stat>control charts>variables charts for individuals>individual…
varriable is Data
Look into the History Window and you should see the following
Name c1 “data”
Random 25 ‘data’;
Normal 0.0 1.0.
Now lets create a macro and run it.
Open Notepad (or other text editor)
On the first two lines type;
Now copy and paste the 7 lines from the history window in minitab (shown above)
on a new line at the end, (note there is a period after endmacro and testmacro.)
Now perform a “save as” and save the text file to the Minitab Macro Directory. Use the name of
Now you have to change the file type from .txt to all or it will append the .txt on the end of your file.
For V15 the default macro directory is found at;
C:\Program Files\Minitab 15\English\Macros\
To run the macro. Open a new minitab project that is blank.
Edit>Command Line Editor (or CTRL-L)
and then press the submit commands button and it will run.