Formats (PRINT command)
By default, PRINT uses the dictionary print formats. You can specify formats for some
or all variables that are specified on PRINT. For a string variable, the specified format must have a width at
least as large as the width of the dictionary format. String values
are truncated if the specified width is smaller than the width of
the dictionary format.
- Format specifications can be either column-style
or FORTRAN-like (see
DATA LIST). The column location that is specified with column-style formats or that is implied with FORTRAN-like formats refers to the column in which the variable will be displayed. - A format specification following a list of variables applies to all variables in the list. Use an asterisk to prevent the specified format from applying to variables that precede the asterisk. The specification of column locations implies a default print format, and that format applies to all previous variables if no asterisk is used.
- Printable numeric formats are
F,COMMA,DOLLAR,CC,DOT,N,E,PCT,PIBHEX,RBHEX,Z, and the date and time formats. Printable string formats areAandAHEX. Note that hex and binary formats use different widths. For example, theAHEXformat must have a width that is twice the width of the correspondingAformat. For more information about specifying formats and more information about the available formats, seeDATA LISTand Variable Formats . - Format specifications are in effect only for the
PRINTcommand. The specifications do not change the dictionary print formats. - When a format is specified for a variable, the automatic
blank following the variable in the output is suppressed. To preserve
the blank between variables, use a string
(see Strings), specify blank columns in the format,
or use an
XorTformat element (seeDATA LISTfor information aboutXandT).
Example
PRINT / TENURE (F2.0) ' ' MOHIRED YRHIRED DEPT *
SALARY85 TO SALARY88 (4(DOLLAR8,1X)) NAME.
EXECUTE.
- Format
F2.0is specified for TENURE. A blank string is specified after TENURE because the automatic blank following the variable is suppressed by the format specification. - MOHIRED, YRHIRED, and DEPT are displayed with default
formats because the asterisk prevents them from receiving the
DOLLAR8format that is specified for SALARY85 to SALARY88. The automatic blank is preserved for MOHIRED, YRHIRED, and DEPT, but the blank is suppressed for SALARY85 to SALARY88 by the format specification. The1Xformat element is therefore specified withDOLLAR8to add one blank after each value of SALARY85 to SALARY88. -
NAMEuses the default dictionary format.