Reading formatted data
on the datafile line supplies a Fortran like
statement for reading fixed format files.
A simple example is
which reads 3 integer fields and 5 floating
point fields from the first 42 characters of each data line. A format
statement is enclosed in parentheses and may include 1 level
of nested parentheses, for example, e.g.
Field descriptors, where r is an optional repeat count, are
to skip r character positions,
to define r consecutive fields of w characters width,
to define r consecutive fields of w
characters width, and
to define r
consecutive fields of w characters width; d indicates where to
insert the decimal point if it is not explicitly present in the
In ASReml, the
field descriptors are treated
identically and simply set the field width. Whether the field is
interpreted alphabetically or as a number
is controlled by the
Other legal components of a format statement are
character; required to separate fields -
blanks are not permitted in the format.
indicates the next field is to be read from the next line. However
on the end of a format to skip a line is not honoured.
; the default action is to read blank fields as missing values.
are also honoured as missing values. If you wish
to read blank fields as zeros, include the string
; switches back to 'blank missing' mode.
; moves the 'last character read' pointer to
line position c so that the next field starts at position c+1.
goes back to the beginning of the line.
invokes debug mode.
A format showing these components is
and is suitable for
reading 27 fields from 2 data records such as
111122223333xxxxxxxxALPHAFxx 4.12xx 5.32xx 6.32
xxxx123 567 901 345 7890
Return to start