!DO ... !ENDDO provides a mechanism to repeat transformations on a set of variables. All tranformations except !DOM, !RESCALE and !SPLIT operate once on a single field unless preceded by a !DO transformation.

The !DO transformation has three arguments: n [it iv]. n is the number of times the following transformations are to be performed. it (default 1) is the increment applied to the target field. iv (default 0.0) is the increment applied to the transformation argument. The default for n is the number of variables in the current field definition. !ENDDO is formally equivalent to !DO 1 and is implicit when the next field definition begins.

Note that when several transformations are repeated, the processing order is that each is performed n times before the next is processed (contrary to the implication of the syntax). Since it is often hard to distinquish O (capital o) from 0 (zero), it is suggested !DO be specified in lower case ( !do) as shown in the following examples.
 Markers !G 12 !do !D * \# Delete records with missing marker values
The default arguments ( 12, 1, 0.) are used.
 Y1 Y2 Y3 Y4 Y5 Ymean !=0. !do 5 0 1 !+Y1 !ENDDO !/5
is equivalent to
 Y1 Y2 Y3 Y4 Y5 Ymean !=0.  !+Y1 !+Y2 !+Y3 !+Y4 !+Y5 !/5

Return to start