x
Syntax: How to Customize a Column Title in a Request
fieldname AS 'title_line_1 [,title_line_2,...]'
where:
- fieldname
- Is a field named in a display command
(such as PRINT or SUM), ACROSS phrase, or BY phrase.
- title_line_1,title_line_2
- Is the customized column title, enclosed
in single quotation marks.
To specify a multiple-line column
title, separate each line with a comma.
To customize a column title for a calculated
value, use the syntax:
COMPUTE fieldname[/format] = expression AS 'title'
For
related information, see Creating Temporary Fields.
Tip:
- To suppress
the display of a column title, enter two consecutive single quotation
marks without the intervening space. For example:
PRINT LAST_NAME AS ''
- To display
underscores, enclose blanks in single quotation marks.
- If you use
an AS phrase for a calculated value, repeat the COMPUTE command before
referencing the next computed field.
Example: Customizing Column Titles in a Request
This request customizes the column titles
for the field named in the SUM command (SALARY), and the fields
named in the BY phrases (DIV and DEPT).
TABLE FILE EMPDATA
SUM SALARY AS 'Total,Salary'
BY DIV AS 'Division'
BY DEPT AS 'Department'
WHERE DIV EQ 'NE' OR 'SE' OR 'CORP'
HEADING
"Current Salary Report"
ON TABLE SET STYLE *
TYPE=REPORT,GRID=OFF,$
ENDSTYLE
END
The output is:
Example: Suppressing a Column Title
This request suppresses the column title
for LAST_NAME. It also illustrates a multiple-line column title
(EMPLOYEE NUMBER) for the data for EMP_ID.
TABLE FILE EMPLOYEE
PRINT FIRST_NAME AS 'NAME' AND LAST_NAME AS ''
BY DEPARTMENT
BY EMP_ID AS 'EMPLOYEE,NUMBER'
ON TABLE SET PAGE-NUM OFF
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF, $
ENDSTYLE
END
The output is:
Example: Customizing a Column Title for a Calculated Value
This request customizes the column title
for the calculated value REV.
TABLE FILE SALES
SUM UNIT_SOLD RETAIL_PRICE
COMPUTE REV/D12.2M = UNIT_SOLD * RETAIL_PRICE;AS 'GENERATED REVENUE'
BY PROD_CODE
WHERE CITY EQ 'NEW YORK'
ON TABLE SET PAGE-NUM OFF
ON TABLE SET ONLINE-FMT HTML
ON TABLE SET STYLESHEET *
TYPE=REPORT, GRID=OFF, $
ENDSTYLE
END
The output is: