# (Comment symbol)

Used to add comments to a Minitab macro or exec without interfering with the commands themselves. When executing commands, Minitab ignores everything from the comment symbol (#) to the end of the line.

In the example macro that follows, the comments have been added to explain what each line of command language will do:

        GMACRO #Starts the global macro
Random #Names the macro
        rand 10 C1. #Adds 10 rows of random data to C1
        ENDMACRO #Ends the macro

Adding comments can make it easier for others to use and edit your macros and exec files.

& (Continuation symbol)

Used when invoking session commands to show that the command continues on the next line. This is used for breaking long commands into segments which can be fit on the command line and are easier to read.

In the example that follows, command language is used to create a complex polygon. Instead of writing all of the coordinates on a single line, the continuation symbol was used to make it more manageable.

Plot Height * Weight;
Polygon 114.911 70.4736 134.524 71.8742 & 
147.784 74.7336 167.398 75.5506 & 
171.818 74.2668 185.078 75.7257 & 
195.852 75.7257 195.576 73.5081 & 
203.587 72.3994 219.057 72.7495 & 
218.781 71.4657 201.101 71.2906 & 
186.183 70.8821 178.172 70.0068 & 
178.448 68.5479 167.398 67.9643 & 
131.486 63.2959 144.469 61.0783 & 
140.049 60.4948 125.132 61.8953 & 
117.121 61.6035 104.966 60.9616 & 
103.584 62.4789 92.258 62.6539 & 
92.258 63.5293 112.701 66.0969 & 
106.071 68.1978.

If you type the symbol & at the end of a line in the Session window, Minitab displays the CONT> prompt on the next line to indicate a continuation of the previous line.

When entering data using the READ command, what can I use to separate entries other than a space?

When using READ, you can use a space or a comma to separate data entries. For example:

1 2 

What is the macro syntax for the KKCAT, KKNAME, and KKSET commands?

KKCAT concatenates, or combines, the text in the first constant K with the text in the second constant K, and stores the combined string of text in the third constant K. For example, if the constant K1 contained "Normality" and the constant K2 contained "Test", and you want to store "Normality Test" in constant K3, use the following syntax:

KKNAME stores the name of column C in the constant K. For example, if you want to store the name of column C1 in the constant K4, use the following syntax:


KKSET stores the text within the double quotes in the constant K. For example, if you want store the word Minitab in constant K5, use the following syntax:

KKSET K5 "Minitab"

Is there a command that quits a worksheet from within a global macro or an exec?

Yes, you can use the WORKSHEET command with the CLOSE subcommand. Suppose you want to close a worksheet named "Worksheet 1". Use the following commands:

WORKSHEET "Worksheet 1";

If you do not want the user to be prompted to save the worksheet that is being quit, you can also add the NOPROMPT subcommand:

WORKSHEET "Worksheet 1";

When writing global and local macros, what command is needed to transfer control back to interactive Minitab?

In an exec, EXIT terminates Minitab. In a global or local macro, the command EXIT transfers control back to interactive Minitab.


In an exec, EXIT terminates Minitab.

How can I store the data type (text, real numbers or integers, date/time values, or no data at all) of a column or constant?

Use the DTYPE command to store the data type as constants. For example, suppose you want the data type of C1 to be stored in K1.

  1. Choose Edit > Command Line Editor.
  2. Type: DTYPE C1 K1.
  3. Click Submit Commands.
    K1 will equal 0 if C1 contains text, 1 if real numbers, 2 if integers, 3 if date/time values, and 10 if empty.

    If the column contains integers, real numbers, or date/time values, but it is formatted as text (i.e. the column number appears with a -T), K1 will equal 0.

If I want to use a suffixed variable in a macro, do I have to include it on the template?

If the suffixed variable has a determined range, you do not need to include it on the template. For example, you could declare columns b.1-b.10 and not include it on the template.

MCOLUMN a b.1-b.10

If the suffixed variable has an undetermined range, the suffixed variable or the suffix must be defined on the template. For example, if n is a constant, you could include the entire suffixed variable or the suffix on the template.

SAMPLE a b.1-b.n 
MCOLUMN a b.1-b.n 


SAMPLE a b n 
MCOLUMN a b c.1-c.n

You could use an optional subcommand so that the suffixed variable with an undetermined range is on the template, but the user does not have to include it when invoking the macro. For example,

SAMPLE a b; 
OBS n. 
DEFAULT n = 600 
LET n = a * b

How can I find the first available (empty, blank) column in the worksheet using a macro?

Suppose you are writing a global macro and want to name the first available column in the worksheet "EMPTY". Here are the commands in a global macro named FINDNEXT.

DO K101 = 1:1000 
 DTYPE CK101 K102 
 IF K102 = 10 

This macro assumes that you do not have more than 1000 columns and that constants K101, K102 and K103 are empty.


For more information about the DTYPE Session command, choose Help > Help > Session Commands. Click Alphabetical Command List. Click DTYPE.

In a macro, how do I name a column with the value of a constant?

You can use the NAME command. For example, to name column C1 with the value of K1:

By using this site you agree to the use of cookies for analytics and personalized content.  Read our policy