Obsolete continuation character (&)

In previous versions the & symbol indicated that a command continued on the next line, for example:
PLS C18 = C1-C17 c1*c2 c1*c3 c1*c4 c1*c5 c1*c6 c1*c7 c1*c8 c1*c9 c1*c10 c1*c11&
 c1*c12 c1*c13 c1*c14 c1*c15 c1*c16 c1*c17; 
In the current version of Minitab, session commands with an & symbol create errors. Instead, type everything on 1 line.
PLS C18 = C1-C17 c1*c2 c1*c3 c1*c4 c1*c5 c1*c6 c1*c7 c1*c8 c1*c9 c1*c10 c1*c11 c1*c12 c1*c13 c1*c14 c1*c15 c1*c16 c1*c17; 

# (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.

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:

READ C1 C2 
1 2 
3,4
END.

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:
KKCAT K1 K2 K3

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:

KKNAME K4 C1

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";
CLOSE.

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";
CLOSE;
NOPROMPT.

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

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

Note

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 View > Command Line/History.
  2. Type the following: DTYPE C1 K1.
  3. Click Run.
    K1 will equal 0 if C1 contains text, 1 if real numbers, 2 if integers, 3 if date/time values, and 10 if empty.
    Note

    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.

MACRO
SAMPLE a
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.

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

OR

MACRO 
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,

MACRO 
SAMPLE a b; 
OBS n. 
MCONSTANT a b 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.

GMACRO 
FINDNEXT 
DO K101 = 1:1000 
 DTYPE CK101 K102 
 IF K102 = 10 
  NAME CK101 "EMPTY" 
 EXIT 
 ENDIF 
ENDDO 
ENDMACRO
Note

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

Note

For more information about the DTYPE Session command, go to Minitab Session Command Help. 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:

NAME C1 K1