Here is an example using a version of the macro ANALYZE3 (see CALL, RETURN to view this macro).
GMACRO ANALYZE4 # NOTE How many observations do you have this month? SET C90; FILE "TERMINAL"; NOBS 1. COPY C90 K90 IF K90 < 5 NOTE Data set has fewer than 5 observations. NOTE No analysis will be done. Here are the data. PRINT C1-C3 ELSE LET C5 = LOGE(C1) REGRESS C5 2 C2 C3 ENDIF ENDMACRO |
When you type %ANALYZE4, Minitab displays the note, "How many observations do you have this month?" and pauses, waiting for a user response. After the user types a number and presses <Enter>, that number is entered into C90.
The subcommand NOBS tells Minitab the number of values to expect from the user. If you omit NOBS, the user will have to type END to signal the end of data input before the macro will continue to execute. If you include NOBS, the macro will resume execution after the user has entered the expected number of observations (in our example, one number).
The macro continues executing, using the value for C90 supplied by the user. This is how it looks on the screen:
Executing from file: ANALYZE4.MAC How many observations do you have this month? DATA> 4 Data set has fewer than 5 observations. No analysis will be done. Here are the data.
Data Display
ROW C1 C2 C3 1 44.0 5 8 2 43.5 5 8 3 46.0 5 8 4 39.0 5 13 |
Since you can only use this feature to READ, SET, or INSERT data into columns, in our example we first put our constant into C90, then copied it into K90. The rest of the macro is the same as before.