27.03.2013 Views

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SPSS® 12.0 Command Syntax Reference

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

DO REPEAT—END REPEAT<br />

DO REPEAT stand-in var={varlist } [/stand-in var=...]<br />

{value list}<br />

transformation commands<br />

END REPEAT [PRINT]<br />

Example<br />

DO REPEAT R=REGION1 TO REGION5.<br />

COMPUTE R=0.<br />

END REPEAT.<br />

Overview<br />

The DO REPEAT—END REPEAT structure repeats the same transformations on a specified<br />

set of variables, reducing the number of commands you must enter to accomplish a task.<br />

This utility does not reduce the number of commands the program executes, just the number<br />

of commands you enter. To display the expanded set of commands the program generates,<br />

specify PRINT on END REPEAT.<br />

DO REPEAT uses a stand-in variable to represent a replacement list of variables or values.<br />

The stand-in variable is specified as a place holder on one or more transformation commands<br />

within the structure. When the program repeats the transformation commands, the stand-in<br />

variable is replaced, in turn, by each variable or value specified on the replacement list.<br />

The following commands can be used within a DO REPEAT—END REPEAT structure:<br />

• Data transformations: COMPUTE, RECODE, IF, COUNT, and SELECT IF<br />

• Data declarations: VECTOR, STRING, NUMERIC, and LEAVE<br />

• Data definition: DATA LIST, MISSING VALUES (but not VARIABLE LABELS or VALUE LABELS)<br />

• Loop structure commands: LOOP, END LOOP, and BREAK<br />

• Do-if structure commands: DO IF, ELSE IF, ELSE, and END IF<br />

• Print and write commands: PRINT, PRINT EJECT, PRINT SPACE, and WRITE<br />

• Format commands: PRINT FORMATS, WRITE FORMATS, and FORMATS<br />

Basic Specification<br />

The basic specification is DO REPEAT, a stand-in variable followed by a required equals sign<br />

and a replacement list of variables or values, and at least one transformation command. The<br />

structure must end with the END REPEAT command. On the transformation commands, a<br />

single stand-in variable represents every variable or value specified on the replacement list.<br />

501

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!