The REPORT Procedure |
Interaction: | An ENDCOMP statement must mark the end of the group of statements in the compute block. | ||||||
Featured in: |
|
A compute block can be associated with a report item or with a location (at the top or bottom of a report; at the top or bottom of a page; before or after a set of observations). You create a compute block with the COMPUTE window or with the COMPUTE statement. One form of the COMPUTE statement associates the compute block with a report item. Another form associates the compute block with a location.
For a list of the SAS language elements that you can use in compute blocks, see The Contents of Compute Blocks.
Required Arguments |
You must specify either a location or a report item in the COMPUTE statement.
determines where the compute block executes in relation to target.
executes the compute block at a break in one of the following places:
immediately after the last row of a set of rows that have the same value for the variable that you specify as target or, if there is a default summary on that variable, immediately after the creation of the preliminary summary line. (See How PROC REPORT Builds a Report.)
except in Printer and RTF output, near the bottom of each page, immediately before any footnotes, if you specify _PAGE_ as target.
at the end of the report if you omit a target.
executes the compute block at a break in one of the following places:
immediately before the first row of a set of rows that have the same value for the variable that you specify as target or, if there is a default summary on that variable, immediately after the creation of the preliminary summary line. (See How PROC REPORT Builds a Report.)
except in Printer and RTF output, near the top of each page, between any titles and the column headings, if you specify _PAGE_ as target.
immediately before the first detail row if you omit a target.
Note: If a report contains more columns than will fit on a printed page, then PROC REPORT generates an additional page or pages to contain the remaining columns. In this case, when you specify _PAGE_ as target, the COMPUTE block does NOT re-execute for each of these additional pages; the COMPUTE block re-executes only after all columns have been printed.
Featured in: | Using Aliases to Obtain Multiple Statistics for the Same Variable and Writing a Customized Summary on Each Page |
specifies a data set variable, a computed variable, or a statistic to associate the compute block with. If you are working in the nonwindowing environment, then you must include the report item in the COLUMN statement. If the item is a computed variable, then you must include a DEFINE statement for it.
Featured in: | Consolidating Multiple Observations into One Row of a Report and Creating a Column for Each Value of a Variable |
Note: The position of a computed variable is important. PROC REPORT assigns values to the columns in a row of a report from left to right. Consequently, you cannot base the calculation of a computed variable on any variable that appears to its right in the report.
Options |
specifies the style to use for the text that is created by any LINE statements in this compute block. See Using Style Elements in PROC REPORT for details.
Restriction: | This option affects only the HTML, RTF, and Printer destinations. |
Tip: | FONT names that contain characters other than letters or underscores must be enclosed by quotation marks. |
Featured in: | Specifying Style Elements for ODS Output in Multiple Statements |
controls when the compute block executes. If you specify a location (BEFORE or AFTER) for the COMPUTE statement, then you can also specify target, which can be one of the following:
is a group or order variable.
When you specify a break variable, PROC REPORT executes the statements in the compute block each time the value of the break variable changes.
in monospace output destinations, causes the compute block to execute once for each page, either immediately after printing any titles or immediately before printing any footnotes. justification controls the placement of text and values. It can be one of the following:
CENTER |
centers each line that the compute block writes. | ||
LEFT |
left-justifies each line that the compute block writes. | ||
RIGHT |
right-justifies each line that the compute block writes.
|
Featured in: | Writing a Customized Summary on Each Page |
specifies the type. (Optional) Also specifies the length of report-item. If the report item that is associated with a compute block is a computed variable, then PROC REPORT assumes that it is a numeric variable unless you use a type specification to specify that it is a character variable. A type specification has the form
CHARACTER <LENGTH=length> |
where
specifies that the computed variable is a character variable. If you do not specify a length, then the variable's length is 8.
Alias: | CHAR |
Featured in: | Calculating Percentages |
specifies the length of a computed character variable.
Default: | 8 |
Range: | 1 to 200 |
Interaction: | If you specify a length, then you must use CHARACTER to indicate that the computed variable is a character variable. |
Featured in: | Calculating Percentages |
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.