You can use text data in columns, in stored constants, and as text strings in all three types of macros. In addition, you can pass a text string into a macro by enclosing the string in double quotes when invoking the macro. The passed string can then be assigned to a constant in your macro. Constants that hold text data are useful for specifying graph titles, file names, and names for variables that could be created in a local macro.
The following local macro receives two strings when invoked and assigns them to constants.
MACRO REVERSE file1 file2 # # REVERSE reads the first 3 columns of the input file, file1. # MCONSTANT file1 file2 MCOLUMN X Y Z PRINT file1 file2 READ X Y Z; FILE file1. WRITE Z Y X; FILE file2. # # REVERSE now stores the 3 columns from file1 in reverse order as the output file, file2. # ENDMACRO |
We could use this macro to reverse the columns in the file called INPUT.DAT and store the reversed data in the file called OUTPUT.DAT by using
%REVERSE "INPUT" "OUTPUT"
Three macro commands allow you to store text in a constant. They are especially useful for displaying titles and other annotation on macro output. The following text commands are used in the body of %macros, which means the commands can only be used in global or local macros:
KKNAME stores the name of column C in the constant K.
KKSET stores the text within the double quotes in the constant K. You can also use the regular Minitab command LET to store text in constants. KKSET, however, can store several text strings in several constants at once, whereas LET stores one text string in one constant. (Note, in older versions of Minitab, you used single quotes around the text in KKSET. You can still use single quotes, but they are not recommended).
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 X contained "Mr." and the text constant Y contained "Jones", the following command KKCAT X Y Z would put the string "Mr.Jones" in constant Z.
Tip: How to trim text strings in macros
Note |
KKNAME, KKSET, and KKCAT can only be used in global or local macros. |
Minitab help | Stat | Graph | SixSigma | DOE | Glossary | Reliability | SPC,MSA,CPK | ||
|