YESNO
    

YESNO K

Prompts the user for a decision to execute or skip a block of commands.

YESNO reads a "Yes" or "No" response from the terminal and changes the value of its argument, K, accordingly. YESNO sets K = 1 when the user responds "Yes" and K = 0 when the user responds "No." YESNO takes only one argument, and it must be a stored constant.

Any response beginning with an upper or lower case Y is interpreted as a "Yes"; any response beginning with an upper or lower case N is interpreted as "No." With any other answer, the user receives the message "Please answer Yes or No" and is given another opportunity to enter an acceptable answer. If a valid response is not obtained after five tries, a "No" answer is assumed.

YESNO does not issue a prompt; it only reads a response. The macro writer must use the NOTE command to prompt the user for a response.

Here is a version of the macro ANALYZE4 (see Example of prompting a user with SET to view this macro), using YESNO.

GMACRO 

ANALYZE5 

#

NOTE Do you have at least 5 observations this month? 

YESNO K90 

IF K90 = 0 

  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

Note: If you use YESNO while command language is turned off in the Session window, an error message will be displayed and the macro will stop.