In this section: Reference: |
A field's format is defined in the Master File. You can, however, change the format of a report column. Column titles in a report can be left justified, right justified, or centered. By default, column titles for alphanumeric fields are left justified, and column titles for numeric and date fields are right justified.
For details, see Customizing Tabular Reports.
The UNIT_PRICE field has a format of D7.2 as defined in the GGPRODS Master File. To add a floating dollar sign to the display, the field format can be redefined as follows:
TABLE FILE GGPRODS PRINT UNIT_PRICE/D7.2M END
The output is:
Unit Price ----- $58.00 $81.00 $76.00 $13.00 $17.00 $28.00 $26.00 $96.00 $125.00 $140.00
The following request illustrates column title justification with a format specification, a BY field specification, and an AS phrase specification:
TABLE FILE CAR PRINT MODEL/A10 STANDARD/A15/R AS 'RJUST,STANDARD' BY CAR/C WHERE CAR EQ 'JAGUAR' OR 'TOYOTA' END
The output is:
RJUST CAR MODEL STANDARD ---------------- ----- --------------- JAGUAR V12XKE AUT POWER STEERING XJ12L AUTO RECLINING BUCKE WHITEWALL RADIA WRAP AROUND BUM 4 WHEEL DISC BR TOYOTA COROLLA 4 BODY SIDE MOLDI MACPHERSON STRU
In this section: |
The width of a report column is set to the width of the column title, or the corresponding field display length, whichever is wider. You can change the width by reformatting the column or editing the title.
For example, the LAST_NAME field is defined with a format of A15 in the Master File, while its field name is only nine characters wide, so the LAST_NAME column in a report will be 15 characters wide.
Furthermore, two spaces are placed between columns on the printed report unless the report width is too wide, in which case one space is inserted between columns. If the report is still too wide, it needs to be paneled.
Note: The default spacing can be overridden by using IN or OVER. You can also use SET SPACES to control column spacing. For more information, see Customizing Tabular Reports.
When a field is reformatted in a request (for example, SUM field/format), an internal COMPUTE field is created to contain the reformatted field value and display on the report output. If the original field has a missing value, that missing value can be propagated to the internal field by setting the COMPMISS parameter ON. If the missing value is not propagated to the internal field, it displays a zero (if it is numeric) or a blank (if it is alphanumeric). If the missing value is propagated to the internal field, it displays the missing data symbol on the report output.
SET COMPMISS = {ON|OFF}
where:
The following procedure prints the RETURNS field from the SALES data source for store 14Z. With COMPMISS OFF, the missing values display as zeros in the column for the reformatted field value. (Note: Before trying this example, you must make sure that the SALEMISS procedure, which adds missing values to the SALES data source, has been run.)
SET COMPMISS = OFF TABLE FILE SALES PRINT RETURNS RETURNS/D12.2 AS 'REFORMATTED,RETURNS' BY STORE_CODE WHERE STORE_CODE EQ '14Z' END
The output is:
REFORMATTED STORE_CODE RETURNS RETURNS ---------- ------- ----------- 14Z 2 2.00 2 2.00 0 .00 . .00 4 4.00 0 .00 3 3.00 4 4.00 . .00 4 4.00
With COMPMISS ON, the column for the reformatted version of RETURNS displays the missing data symbol when a value is missing:
SET COMPMISS = ON TABLE FILE SALES PRINT RETURNS RETURNS/D12.2 AS 'REFORMATTED,RETURNS' BY STORE_CODE WHERE STORE_CODE EQ '14Z' END
The output is:
REFORMATTED STORE_CODE RETURNS RETURNS ---------- ------- ----------- 14Z 2 2.00 2 2.00 0 .00 . . 4 4.00 0 .00 3 3.00 4 4.00 . . 4 4.00
Information Builders |