A suffixed variable is a variable that represents a range of values. The range can include columns and constants. They are most useful when:
A suffixed variable is a variable name followed by a period, followed by the suffix. The suffix can either be an integer or a stored constant. The range of suffixed variables can be abbreviated using a dash.
Variable Name |
Period |
Suffix |
Suffixed Variable |
Range of Suffixed Variables |
X |
. |
1 |
X.1 |
X.1-X.5 |
My_Data |
. |
1 |
My_Data.1 |
My_Data.1-My_Data.5 |
Test |
. |
1 |
Test.1 |
Test.1-Test.testnum |
Test |
. |
testnum |
Test.testnum |
|
The variable name and the suffix can each have up to eight characters. However, only the last eight characters of a suffixed variable, including the period, are shown when a suffixed variable is printed. So if you plan to print out suffixed variables, you should probably keep them short, as in Col.1-Col.5 or X.1-X.N.
Within the body of a macro, suffixed variables can be used in any order, alone or in groups. But when they appear on the template or in declaration statements, they must follow these rules:
In the template and declarations, you must give a list of suffixed variables as one complete list, in order, and using a dash. All variables in the list must be of the same variable type.
|
Templates |
Declarations |
Legal: |
TRIM X.1-X.5 TRIM X.1-X.5 Y.1-Y.8 TRIM Z X.3-X.20 W1 W2 |
MCOLUMN X.1-X.5 MCONSTANT X.1-X.5 Y.1-Y.8 MCOLUMN Z X.3-X.20 W1 W2 |
|
|
|
Illegal: |
TRIM X.1-X.3 X.4-X.5 TRIM X.1-X.2 Y X.3-X.5 TRIM X.5-X.1 |
MCOLUMN X.1-X.3 X.4-X.5 MCONSTANT X.1-X.2 Y X.3-X.5 MCOLUMN X.5-X.1 |
In the template, each command and subcommand can have as many regular arguments and as many defined-range arguments as you wish. However, the command or subcommand can have only one undetermined-range argument.
Legal template statements: |
MYPROG1 X.1-X.10 Y.1-Y.N MYPROG2 X.1-X.10 Y.4-Y.20 MYPROG3 X.1-X.M; |
|
|
Illegal template statement: |
MYPROG4 X.1-X.M Y.1-Y.N |
Once you have declared a suffixed variable, you cannot declare another variable with the same prefix, even one of the same type. The following two declarations cannot be used in the same program. Because the prefix "X" is used with MCOLUMN, it cannot be used again-either for additional columns or for any other type of variable.
Do not declare the suffix of a suffixed variable. For example, suppose you have the range X.1-X.N. You do not give N a value; Minitab applies a value to N automatically when you invoke the command.
Example of suffixed variables with a defined range
Example of using a constant to define a range of columns
Example of suffixed variables with an undetermined range