Next: The GET
Command, Previous: The LOOP
and BREAK
Commands, Up: MATRIX [Contents][Index]
READ
and WRITE
CommandsThe READ
and WRITE
commands perform matrix input and
output with text files. They share the following syntax for
specifying how data is divided among input lines:
/FIELD=first TO last [BY width] [/FORMAT=format]
Both commands require the FIELD
subcommand. It specifies the
range of columns, from first to last, inclusive, that the
data occupies on each line of the file. The leftmost column is column
1. The columns must be literal numbers, not expressions. To use
entire lines, even if they might be very long, specify a column range
such as 1 TO 100000
.
The FORMAT
subcommand is optional for numerical matrices. For
string matrix input and output, specify an A
format. In
addition to FORMAT
, the optional BY
specification on
FIELD
determine the meaning of each text line:
BY
nor FORMAT
, the numbers in the text file
are in F
format separated by spaces or commas. For
WRITE
, PSPP uses as many digits of precision as needed to
accurately represent the numbers in the matrix.
BY width
divides the input area into fixed-width fields
with the given width. The input area must be a multiple of
width columns wide. Numbers are read or written as
Fwidth.0
format.
FORMAT=countF
divides the input area into count
equal-width fields per line. The input area must be a multiple of
count columns wide. Another format type may be substituted for
F
.
FORMAT=Fw
[.d
] divides the input area into fixed-width
fields with width w. The input area must be a multiple of w
columns wide. Another format type may be substituted for F
.
The READ
command disregards d.
FORMAT=F
specifies format F
without indicating a field
width. Another format type may be substituted for F
. The
WRITE
command accepts this form, but it has no effect unless
BY
is also used to specify a field width.
If BY
and FORMAT
both specify or imply a field width,
then they must indicate the same field width.
Next: The GET
Command, Previous: The LOOP
and BREAK
Commands, Up: MATRIX [Contents][Index]