IF logical expression (a block of Minitab and macro commands) ELSEIF logical expression (a block of Minitab commands and macro statements) ELSE (a block of Minitab commands and macro statements) ENDIF |
Allows you to execute different blocks of code depending on a logical condition. A logical expression is any expression from the LET command. The comparison and Boolean operators listed below are the features of LET that are most often used in IF.
= |
or |
EQ |
equal to |
& |
or |
AND |
~= |
or |
NE |
not equal to |
| |
or |
OR |
< |
or |
LT |
less than |
~ |
or |
NOT |
> |
or |
GT |
greater than |
|
|
|
<= |
or |
LE |
less than or equal to |
|
|
|
>= |
or |
GE |
greater than or equal to |
|
|
|
In most cases the logical expression evaluates to a single number. If the number is 0 (false), the block of statements is skipped; if it is not 0 (true), the block is executed. If the logical expression evaluates to a column, then if all entries in the column are 0, the expression is considered false, otherwise it is considered true.
You can use multiple ELSEIF statements within the IF-ENDIF block.
Here is a simple example, using a global macro:
GMACRO |