List-Processing Loop (DEFINE-!ENDDEFINE command)

The syntax of a list-processing loop is as follows:

!DO !var !IN (list)
    statements
!BREAK
!DOEND

Example

DEFINE macdef (!POS !CHAREND('/'))
!DO !i !IN (!1)
frequencies variables = !i.
!DOEND
!ENDDEFINE.
macdef VAR1 VAR2 VAR3  /.

Example

DEFINE macdef (!POS !CHAREND('/'))
!DO !i !IN (!1)
sort cases by !i.
report var = earnings
  /break = !i
  /summary = mean.
!DOEND
!ENDDEFINE.

macdef SALESMAN REGION MONTH /.