Calculates minimum field widths for printing data structures (R.W. Payne).
Option
IPRINT = string tokens |
What identifier and/or text to print for the structure (identifier , extra ); default is to take the IPRINT setting of each STRUCTURE |
---|
Parameters
STRUCTURE = identifiers |
Data structures to be printed |
---|---|
FIELDWIDTH = scalars |
Saves the minimum field widths |
DECIMALS = scalars |
Number of decimal places to be used for numerical data structures; if unset, a default is obtained using the DECIMALS procedure |
SKIP = scalars |
Number of spaces to leave before each value of the structure; default 1 |
FREPRESENTATION = string tokens |
How to represent factor values (labels , levels , ordinals ); default is to use labels if available, otherwise levels |
Description
MINFIELDWIDTH
can be used to calculate the minimum field width that would be required to print a data structure in an even column down the page using the PRINT
directive. The data structures are specified by the STRUCTURE
parameter, and can be any of those supported by Genstat. The calculated field width is saved, in a scalar, by the FIELDWIDTH
parameter.
The IPRINT
option indicates how the values of each STRUCTURE
are to be labelled, so that the field widths will be wide enough for the column headings as well as the data values. The identifier
setting uses the identifier of the STRUCTURE
, while the extra
setting used the information that can be specified by the EXTRA
parameter when data structures are defined by directives like VARIATE
, FACTOR
and TEXT
. You can set IPRINT=*
to indicate that the values are not to be labelled by either of these. Alternatively, if IPRINT
is not specified, the default is taken from the IPRINT
attribute of the STRUCTURE
(which can be set by the IPRINT
option of VARIATE
, FACTOR
, TEXT
etc). This is the same default that is used by PRINT
if its own IPRINT
option is not specified.
With numerical structures, like variates or matrices, the DECIMALS
parameter specifies the number of decimal places that are to be used. If you set DECIMALS
to a scalar containing a missing value, the DECIMALS
procedure is used by MINFIELDWIDTH
to determine a default number of decimal places, and this is stored in the scalar so that you can use it later. The DECIMALS
procedure is also used to obtain a default if the DECIMALS
parameter is not set.
The SKIP
parameter specifies how many spaces are to be left before each element of each STRUCTURE
; default 1.
The FREPRESENTATION
parameter controls the printing of the factor values. The default is to print labels if there are any; if there are none, it is assumed that levels will be printed. The ordinals
setting represents the values by the integers 1 upwards.
Option: IPRINT
.
Parameters: STRUCTURE
, FIELDWIDTH
, DECIMALS
, SKIP
, FREPRESENTATION
.
Action with RESTRICT
Any restrictions are ignored.
See also
Directive: PRINT
.
Procedure: DECIMALS
.
Commands for: Input and output.
Example
CAPTION 'MINFIELDWIDTH example'; STYLE=meta VARIATE X[1...7]; VALUE=!(0.1,0.2...0.9),!(11,21...91),!(-1...-9),\ !(-99,0,999),!(-999,0,99),!(-99,0,9999),!(0) SCALAR D[1...7],F[1...7] MINFIELDWIDTH [IPRINT=*] X[]; FIELDWIDTH=F[]; DECIMALS=D[] PRINT F[],D[]; FIELD=11; DECIMALS=0 PRINT [IPRINT=*] X[]; FIELD=F[]; DECIMALS=D[]