Creating Detail and Summary Reports with the REPORT Procedure |
PROC REPORT Statements |
PROC REPORT <DATA=SAS-data-set><option(s)>; |
BREAK location break-variable </option(s)>; |
COLUMN column-specification(s); |
DEFINE report-item /<usage> <option(s)>; |
RBREAK location</option(s)>; |
TITLE<n> <'title'>; |
WHERE where-expression; |
starts the procedure. If no other statements are used, then SAS shows all variables in the SAS-data-set in a detail report in the REPORT window. If the data set contains only numeric data, then PROC REPORT shows all variables in a summary report. Other statements, listed below, enable you to control the structure of the report.
You can specify the following options in the PROC REPORT statement:
specifies the default number of characters for columns that contain computed variables or numeric data set variables.
names the SAS data set that PROC REPORT uses. If you omit DATA=, then PROC REPORT uses the most recently created data set.
inserts a line of hyphens (-) under the column headers at the top of each page of the report.
inserts a blank line beneath all column headers (or beneath the line that the HEADLINE option inserts) at the top of each page of the report.
specifies the number of blank characters between columns. For each column, the sum of its width and the blank characters between it and the column to its left cannot exceed the line size.
specifies the split character. PROC REPORT breaks a column header when it reaches that character and continues the header on the next line. The split character itself is not part of the column header, although each occurrence of the split character is counted toward the 256-character maximum for a label.
selects a windowing or nonwindowing environment.
When you use WINDOWS, SAS opens the REPORT window, which enables you to modify a report repeatedly and to see the modifications immediately. When you use NOWINDOWS, PROC REPORT runs without the REPORT window and sends its results to the SAS procedure output.
produces a default summary at a break (a change in the value of a GROUP or ORDER variable). The information in a summary applies to a set of observations. The observations share a unique combination of values for the break variable and all other GROUP or ORDER variables to the left of the break variable in the report.
You must specify the following arguments in the BREAK statement:
controls the placement of the break lines, where location is
is a GROUP or ORDER variable. PROC REPORT writes break lines each time the value of this variable changes.
You can specify the following options in the BREAK statement:
identifies items that form columns in the report and describes the arrangement of all columns. You can specify the following column-specification(s) in the COLUMN statement:
where report-item identifies items that form columns in the report. A report-item is either the name of a data set variable, a computed variable, or a statistic.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 header, and the headers are stacked one above the other. The header for the leftmost item is on top. If one of the items is an ANALYSIS variable, then a computed variable, or a statistic, its values fill the cells in that part of the report. Otherwise, PROC REPORT fills the cells with frequency counts.
describes how to use and display a report item. A report item is either the name or alias (established in the COLUMN statement) of a data set variable, a computed variable, or a statistic. The usage of the report item is
You can specify the following options in the DEFINE statement:
centers the formatted values of the report item within the column width, and centers the column header over the values.
defines the column header for the report item. Enclose each header in single or double quotation marks. When you specify multiple column headers, PROC REPORT uses a separate line for each one. The split character also splits a column header over multiple lines.
reverses the order in which PROC REPORT displays rows or values of a GROUP, ORDER, or ACROSS variable.
assigns a SAS format or a user-defined format to the report item. This format applies to report-item as PROC REPORT displays it; the format does not alter the format associated with a variable in the data set.
orders the values of a GROUP, ORDER, or ACROSS variable according to the specified order, where
orders values according to their order in the input data set.
orders values by their formatted (external) values. By default, the order is ascending.
orders values by their unformatted values, which yields the same order that PROC SORT would yield. This order is operating environment dependent. This sort sequence is particularly useful for displaying dates chronologically.
right-justifies the formatted values of the specified report item within the column width and right-justifies the column headers over the values. If the format width is the same as the width of the column, then RIGHT has no affect on the placement of values.
defines the number of blank characters to leave between the column that is being defined and the column immediately to its left. For each column, the sum of its width and the blank characters between it and the column to its left cannot exceed the line size.
associates a statistic with an ANALYSIS variable. PROC REPORT uses this statistic to calculate values for the ANALYSIS variable for the observations represented by each cell of the report. If you do not associate a statistic with the variable, then PROC REPORT calculates the SUM statistic. You cannot use statistic in the definition of any other kind of variable.
defines the width of the column in which PROC REPORT displays report-item.
produces a default summary at the beginning or end of a report.
You must specify the following argument in the RBREAK statement:
You can specify the following options in the RBREAK statement:
specifies to double overline each value that appears in the summary line.
writes a blank line after the last break line of a break located at the beginning of the report.
includes a summary line as one of the break lines. A summary line at the beginning or end of a report contains values for statistics, ANALYSIS variables, or computed variables.
specifies a title. The argument n is a number from 1 to 10 that immediately follows the word TITLE, with no intervening blank, and it specifies the level of the TITLE. The text of each title must be enclosed in single or double quotation marks. The maximum title length depends on your operating environment and the value of the LINESIZE= system option. Refer to the SAS documentation for your operating environment for more information.
subsets the input data set by identifying certain conditions that each observation must meet before an observation is available for processing. Where-expression defines the condition. The condition is a valid arithmetic or logical expression that generally consists of a sequence of operands and operators.
Copyright © 2012 by SAS Institute Inc., Cary, NC, USA. All rights reserved.