Differences between revisions 1 and 2
Revision 1 as of 2023-06-12 15:18:20
Size: 1123
Comment:
Revision 2 as of 2023-06-12 15:42:17
Size: 1707
Comment:
Deletions are marked like this. Additions are marked like this.
Line 27: Line 27:


=== Limitations ===

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

 * [[SPSS/Break|BREAK]]
 * [[SPSS/Compute|COMPUTE]]
 * [[SPSS/Count|COUNT]]
 * [[SPSS/DataList|DATA LIST]]
 * [[SPSS/Logic#Conditional_Processing|DO IF]]
 * [[SPSS/Formats|FORMATS]]
 * [[SPSS/If|IF]]
 * [[SPSS/Leave|LEAVE]]
 * [[SPSS/Loop|LOOP]]
 * [[SPSS/MissintgValues|MISSING VALUES]]
 * [[SPSS/Numeric|NUMERIC]]
 * [[SPSS/Print|PRINT]]
 * [[SPSS/Recode|RECODE]]
 * [[SPSS/Select|SELECT]]
 * [[SPSS/String|STRING]]
 * [[SPSS/Vectors|VECTOR]]
 * [[SPSS/Write|WRITE]]

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)