GOTO Statements

GOTO statements can also be used to move backwards or forwards in the interview. Using a GOTO statement to move backward in a questionnaire leaves the original data intact, with the potential for dirty data and/or corrupted skip patterns. If you must use a GOTO statement to go backwards and save old data test the questionnaire thoroughly before interviewing. If your program causes you to go backwards more than 1000 times, it will abort with a BLOW error that will prevent you from being caught in an infinite loop.

Putting a GOTO statement at a specified place without specifying a label will simply continue the interview at that place. This is often referred to as a receiving GOTO statement.

The syntax for a GOTO statement is:

!GOTO,label

The label specified is the label of another question or a labelled compiler directive.  If the question label is not specified within the program, you will receive an error.  Text may be included on a GOTO statement. If it is included, the next question that displays must not clear the screen, or the text will be lost.

EXAMPLE:

{ QCARDS:
!IF CARDTYPE(6)
!GOTO,VISA }

If question CARDTYPE has a response of 6, the program will go to the question called VISA.

EXAMPLE:

{ QORANGES:
!IF ITEM(ORANGE)
GOTO,QFRUIT }
.
.
{ QFRUIT: !GOTO }

In the above example, QFRUIT is the receiving GOTO. The receiving GOTO is useful when you need to send the interview to a particular place that you can’t specifically address (i.e., send to the end of the questionnaire).