REPORT Procedure

COLUMN Statement

Describes the arrangement of all columns and of headings that span more than one column.
Restriction: You cannot use the COLUMN statement if you use REPORT= in the PROC REPORT statement.
Selecting Variables for a Report

Using Aliases to Obtain Multiple Statistics for the Same Variable

Creating a Column for Each Value of a Variable

Displaying Multiple Statistics for One Variable

Calculating Percentages

How PROC REPORT Handles Missing Values

Syntax

Required Argument

column-specification(s)
is one or more of the following:
  • report-item(s)
  • report-item-1, report-item-2 <. . . , report-item-n>
  • ('header-1 ' < . . . 'header-n '> report-item(s) )
  • report-item=name
where report-item is the name of a data set variable, a computed variable, or a statistic. See Statistics That Are Available in PROC REPORT for a list of available statistics.
report-item(s)
identifies items that each form a column in the report.
report-item-1, report-item-2 <. . . , report-item-n>
identifies report items that collectively determine the contents of the column or columns. These items are said to be stacked in the report because each item generates a heading, and the headings are stacked one above the other. The heading for the leftmost item is on top. If one of the items is an analysis variable, a computed variable, a group variable, or a statistic, then its values fill the cells in that part of the report. Otherwise, PROC REPORT fills the cells with frequency counts.
If you stack a statistic with an analysis variable, then the statistic that you name in the column statement overrides the statistic in the definition of the analysis variable. For example, the following PROC REPORT step produces a report that contains the minimum value of Sales for each sector:
proc report data=grocery;
column sector sales,min;
define sector/group;
define sales/analysis sum;
run;
If you stack a display variable under an across variable, then all the values of that display variable appear in the report.
Interaction:A series of stacked report items can include only one analysis variable or statistic. If you include more than one analysis variable or statistic, then PROC REPORT returns an error because it cannot determine which values to put in the cells of the report.
Tip:You can use parentheses to group report items whose headings should appear at the same level rather than stacked one above the other.
('header-1 ' <… 'header-n '> report-item(s))
creates one or more headings that span multiple columns.
header
is a string of characters that spans one or more columns in the report. PROC REPORT prints each heading on a separate line. You can use split characters in a heading to split one heading over multiple lines. See the discussion of SPLIST= .
In traditional (monospace) SAS output, if the first and last characters of a heading are one of the following characters, then PROC REPORT uses that character to expand the heading to fill the space over the column or columns. Note that the <> and the >< must be paired. − = . _ * + <> ><
Similarly, if the first character of a heading is < and the last character is >, or vice versa, then PROC REPORT expands the heading to fill the space over the column by repeating the first character before the text of the heading and the last character after it.
Note: The use of expanding characters is supported only in monospace destinations. Therefore, PROC REPORT simply removes the expanding characters when the output is directed to an ODS MARKUP, HTML, RTF, or PRINTER destination. Refer to Understanding ODS Destinations in SAS Output Delivery System: User's Guide for more information.
report-item(s)
specifies the columns to span.
report-item=name
specifies an alias for a report item. You can use the same report item more than once in a COLUMN statement. However, you can use only one DEFINE statement for any given name. (The DEFINE statement designates characteristics such as formats and customized column headings. If you omit a DEFINE statement for an item, then the REPORT procedure uses defaults.) Assigning an alias in the COLUMN statement does not by itself alter the report. However, it does enable you to use separate DEFINE statements for each occurrence of a variable or statistic.
Note:You cannot always use an alias. When you refer in a compute block to a report item that has an alias, you must use the alias. However, if the report item shares a column with an across variable, then you must reference the column by column number. (See Four Ways to Reference Report Items in a Compute Block.)