= SPSS Do Repeat = The '''`DO REPEAT`''' command loops a finite number of times. See [[SPSS/Looping|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. * [[SPSS/Loop#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/MissingValues|MISSING VALUES]] * [[SPSS/Numeric|NUMERIC]] * [[SPSS/Print|PRINT]] * [[SPSS/Recode|RECODE]] * [[SPSS/Select|SELECT]] * [[SPSS/String|STRING]] * [[SPSS/Vectors|VECTOR]] * [[SPSS/Write|WRITE]] ---- == Data Model == The `DO REPEAT` command is queued as a pending transformation. ---- == See also == [[https://www.gnu.org/software/pspp/manual/html_node/DO-REPEAT.html|PSPP manual for DO REPEAT]] ---- CategoryRicottone