do with numeric ranges
Quick reference
To define a loop which will be executed for a range of values, type:
do label int_var=start_val1, end_val1, [inc_val1][start_val2, end_val2, [inc_val2]]
If the incremental value is 1 and the loop has one range only, the incremental value can be omitted.
More information
Sometimes, there is a pattern to the numbers in the list: for example, they might increase in steps of 5. You can list them all individually, but it is quicker to enter them as a range with a start, end and incremental value (in the example, 5) separated by commas. The start value must be smaller than the end value, and the increment must be positive. Quantum checks the start and end values and if the start is larger than the end value, the statements inside the loop will not be executed at all. If the increment is negative, the loop is executed for the start value only.
do 20 t5 = 125,145,5
if (c(t5,t5+4).gt.3000) c(t5,t5+4)=$ $
20 continue
This loop is very similar to that used in
do with individually specified numeric values. It is executed for all values of t5 between t5=125 and t5=145 where the value is incremented by 5 each time. The loop says:
if (c(125,129).gt.3000) c(125,129)=$ $
if (c(130,134).gt.3000) c(130,134)=$ $
if (c(135,139).gt.3000) c(135,139)=$ $
if (c(140,144).gt.3000) c(140,144)=$ $
if (c(145,149).gt.3000) c(145,149)=$ $
You can enter as many range specifications as you need on one line, as long as each one is separated by a slash (/):
do 15 t1 = 25,35,2 / 50,62,3
if (numb(c(t1).gt.1) c(t1)' '
15 continue
This loop replaces eleven if statements: t1 will take the values 25, 27, 29, 31, 33, 35, 50, 53, 56, 59 and 62.
If the loop has only one range, and the incremental value is 1, the 1 can be omitted. If t3=11 and t4=15:
do 15 t2 = t3,t4
if (numb(c(t2).gt.1) c(t2)' '
15 continue
checks that columns 11, 12, 13, 14 and 15 each contain no more than 1 code. If not, the column is reset to blank.
See also