Data editing > Flow control > Routing around statements
 
Routing around statements
Sometimes your Quantum program might include statements which refer to certain respondents only; for example, you might want to check only the data associated with a particular brand of soap powder if the respondent bought that powder. These statements can be routed over when the respondent does not buy the powder by using the go to (or goto) statement, followed by a statement number. The statement:
if (c121n'1') go to 50
causes Quantum to go immediately to the statement labeled 50 if column 121 does not contain a ā€˜1ā€™ (for example, the respondent did not buy Brand A soap powder). Any statements between this if statement and statement 50 are ignored whenever a record is read where c121nā€™1ā€™ is true.
The statement labeled 50 can be any Quantum statement, but many people just write:
50 continue
to gather all respondents together before continuing through the rest of the program. This statement is described in the next section. All labels must be attached to statements: a label by itself is an error and Quantum will tell you so.
You can route forwards or backwards in your program, but when routing backwards, take care that you are not creating a situation from which it is impossible to escape: the following will go on and on forever if you let it:
10 t1=t1+1
- - other statements - -
go to 10
To avoid situations like this, make sure that somewhere between statement 10 and go to is another statement that routes you past the go to at some time, for example:
10 t1=t1+1
- - other statements - -
if (t1.gt.10) go to 15
go to 10
15 continue
Do not write statements of the form:
if (c73'7') go to 10; print $errors$
because any statements after the go to will never be executed.
See also
Flow control