Keyword TO
You can establish names for a set of variables
or refer to any number of consecutive variables by specifying the
beginning and the ending variables joined by the keyword TO
.
To establish names for a set of variables with the
keyword TO
, use a character prefix
with a numeric suffix.
- The prefix can be any valid name. Both the beginning and ending variables must use the same prefix.
- The numeric suffix can be any integer, but the first
number must be smaller than the second. For example,
ITEM1 TO ITEM5
establishes five variables named ITEM1, ITEM2, ITEM3, ITEM4, and ITEM5. - Leading zeros used in numeric suffixes are included
in the variable name. For example,
V001 TO V100
establishes 100 variables--V001, V002, V003, ..., V100.V1 TO V100
establishes 100 variables--V1, V2, V3, ..., V100.
The keyword TO
can also be used on procedures and other commands to refer to consecutive
variables on the active dataset. For example, AVAR TO VARB
refers to the variables AVAR and all subsequent variables up to and including VARB.
- In most cases, the
TO
specification uses the variable order on the active dataset. Use theDISPLAY
command to see the order of variables on the active dataset. - On some subcommands, the order in which variables
are named on a previous subcommand, usually the
VARIABLES
subcommand, is used to determine which variables are consecutive and therefore are implied by theTO
specification. This is noted in the description of individual commands.