When the input values
are arranged in a pattern, you can group the informat list. A grouped
informat list consists of two lists:
-
the names of the variables to read
enclosed in parentheses
-
the corresponding informats separated
by either blanks or commas and enclosed in parentheses.
Informat lists can make
an INPUT statement shorter because the informat list is recycled until
all variables are read and the numbered variable names can be used
in abbreviated form. Using informat lists avoids listing the individual
variables.
For example, if the
values for the five variables SCORE1 through SCORE5 are stored as
four columns per value without intervening blanks, this INPUT statement
reads the values:
input (score1-score5) (4. 4. 4. 4. 4.);
However,
if you specify more variables than informats, the INPUT statement
reuses the informat list to read the remaining variables. A shorter
version of the previous statement is
input (score1-score5) (4.);
You can use as many
informat lists as necessary in an INPUT statement, but do not nest
the informat lists. After all the values in the variable list are
read, the INPUT statement ignores any directions that remain in the
informat list. For an example, see
Including More Informat Specifications than Necessary.
The
n*
modifier in an informat list specifies to repeat the next informat
n times.
Here is an example.
input (name score1-score5) ($10. 5*4.);