SPSS Do Repeat

The DO REPEAT command loops a finite number of times. See here for options and alternatives.


Usage

do repeat X='A' 'B' 'C' 'D' 'E' / Y=new1 to new5 / Z=1 to 5.
  if ltrim(rtrim(foo))=X Y=Z.
end repeat.

Each loop expansion list must be of the same length.

The dummy variable name must follow normal rules for variable names. It is allowed to temporarily shadow a pre-existing variable's name.

Substitutions are only made on unquoted words, i.e. BAR does not have the A substituted by the loop expansion.

A variable list can be specified with all pre-existing variables, or all new variables. The two cannot be mixed. For new variable lists, a range is extrapolated from the names. New variables are not created by the DO REPEAT command.

Limitations

Only the following commands are valid in a DO REPEAT structure.


Data Model

The DO REPEAT command is queued as a pending transformation.


See also

PSPP manual for DO REPEAT


CategoryRicottone

SPSS/DoRepeat (last edited 2023-06-14 19:31:53 by DominicRicottone)