The REPORT Procedure |
Tip: | If you do not use a DEFINE statement, then PROC REPORT uses default characteristics. | |||||||
Featured in: |
|
DEFINE report-item / <option(s)>; |
Task | Option | |
---|---|---|
Specify how to use a report item. (sSee Usage of Variables in a Report.) | ||
|
Define the item, which must be a data set variable, as an across variable |
ACROSS |
|
Define the item, which must be a data set variable, as an analysis variable |
ANALYSIS |
|
Define the item as a computed variable |
COMPUTED |
|
Define the item, which must be a data set variable, as a display variable |
DISPLAY |
|
Define the item, which must be a data set variable, as a group variable |
GROUP |
|
Define the item, which must be a data set variable, as an order variable |
ORDER |
Customize the appearance of a report item | ||
|
Exclude all combinations of the item that are not found in the preloaded range of user-defined formats |
EXCLUSIVE |
|
Assign a SAS or user-defined format to the item |
FORMAT= |
Reference a HELP or CBT entry that contains Help information for the report item |
ITEMHELP= |
|
|
Consider missing values as valid values for the item |
MISSING |
|
Order the values of a group, order, or across variable according to the specified order |
ORDER= |
|
Specify that all formats are preloaded for the item. |
PRELOADFMT |
|
For traditional SAS monospace output, define the number of blank characters to leave between the column being defined and the column immediately to its left |
SPACING= |
|
Associate a statistic with an analysis variable |
statistic |
|
Specify a style element (for the Output Delivery System) for the report item |
STYLE= |
|
Specify a numeric variable whose values weight the value of the analysis variable |
WEIGHT= |
|
Define the width of the column in which PROC REPORT displays the report item |
WIDTH= |
Specify options for a report item | ||
|
Create a link in the Table of Contents |
CONTENTS= |
|
Reverse the order in which PROC REPORT displays rows or values of a group, order, or across variable |
DESCENDING |
|
Wrap the value of a character variable in its column |
FLOW |
|
Specify that the item that you are defining is an ID variable |
ID |
|
Suppress the display of the report item |
NOPRINT |
|
Suppress the display of the report item if its values are all zero or missing |
NOZERO |
|
Insert a page break just before printing the first column containing values of the report item |
PAGE |
Control the placement of values and column headings | ||
|
Center the formatted values of the report item within the column width and center the column heading over the values |
CENTER |
|
Left-justify the formatted values of the report item within the column width and left-justify the column headings over the values |
LEFT |
|
Right-justify the formatted values of the report item within the column width and right-justify the column headings over the values |
RIGHT |
Specify the color in the REPORT window of the column heading and of the values of the item that you define |
COLOR= |
|
Define the column heading for the report item |
column-heading |
Required Arguments |
specifies the name or alias (established in the COLUMN statement) of the data set variable, computed variable, or statistic to define.
Note: Do not specify a usage option in the definition of a statistic. The name of the statistic tells PROC REPORT how to use it.
Options |
defines report-item, which must be a data set variable, as an across variable. (See Across Variables.)
Featured in: | Creating a Column for Each Value of a Variable |
defines report-item, which must be a data set variable, as an analysis variable. (See Analysis Variables.)
By default, PROC REPORT calculates the Sum statistic for an analysis variable. Specify an alternate statistic with the statistic option in the DEFINE statement.
Note: Naming a statistic in the DEFINE statement implies the ANALYSIS option, so you never need to specify ANALYSIS. However, specifying ANALYSIS can make your code easier for novice users to understand.
Note: Special missing values show up as missing values when they are defined as ANALYSIS variables.
Featured in: | Ordering the Rows in a Report, Using Aliases to Obtain Multiple Statistics for the Same Variable, and Consolidating Multiple Observations into One Row of a Report |
centers the formatted values of the report item within the column width and centers the column heading over the values. This option has no effect on the CENTER option in the PROC REPORT statement, which centers the report on the page.
specifies the color in the REPORT window of the column heading and of the values of the item that you are defining. You can use the following colors:
BLACK | MAGENTA |
BLUE | ORANGE |
BROWN | PINK |
CYAN | RED |
GRAY | WHITE |
GREEN | YELLOW |
Default: | The color of Foreground in the SASCOLOR window. (For more information, see the online Help for the SASCOLOR window.) |
Restriction: | This option affects output in the interactive report window environment only. |
Note: Not all operating environments and devices support all colors, and in some operating environments and devices, one color might map to another color. For example, if the DEFINITION window displays the word BROWN in yellow characters, then selecting BROWN results in a yellow item.
defines the column heading for the report item. Enclose each heading in single or double quotation marks. When you specify multiple column headings, PROC REPORT uses a separate line for each one. The split character also splits a column heading over multiple lines.
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:
:- = \_ .* +
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.
Default: |
|
||||||||
Tip: |
If you want to use names when labels exist,
then submit the following SAS statement before invoking PROC REPORT:
options nolabel; |
||||||||
Tip: | HEADLINE underlines all column headings and the spaces between them. In traditional (monospace) SAS output, you can underline column headings without underlining the spaces between them, by using the special characters '--' as the last line of each column heading instead of using HEADLINE. (See Consolidating Multiple Observations into One Row of a Report.) | ||||||||
See also: | SPLIT= | ||||||||
Featured in: | Using Aliases to Obtain Multiple Statistics for the Same Variable, Consolidating Multiple Observations into One Row of a Report, and Creating a Column for Each Value of a Variable |
defines the specified item as a computed variable. Computed variables are variables that you define for the report. They are not in the input data set, and PROC REPORT does not add them to the input data set.
In the interactive report window environment, you add a computed variable to a report from the COMPUTED VAR window.
In the nonwindowing environment, you add a computed variable by
including the computed variable in the COLUMN statement
defining the variable's usage as COMPUTED in the DEFINE statement
computing the value of the variable in a compute block associated with the variable.
Featured in: | Creating a Column for Each Value of a Variable and Calculating Percentages |
specifies the text for the entries in the HTML contents file or PDF table of contents for the output that is produced by PROC REPORT. If the DEFINE statement has the PAGE= option and the CONTENTS= option specified with a link-text value assigned, PROC REPORT adds a directory to the TOC and uses the value of link-text as a link for tables created in the Table of Contents.
For information about HTML and PDF output, see Output Delivery System.
reverses the order in which PROC REPORT displays rows or values of a group, order, or across variable.
Tip: | By default, PROC REPORT orders group, order, and across variables by their formatted values. Use the ORDER= option in the DEFINE statement to specify an alternate sort order. |
defines report-item, which must be a data set variable, as a display variable. (See Display Variables.)
excludes from the report and the output data set all combinations of the group variables and the across variables that are not found in the preloaded range of user-defined formats.
Requirement: | You must specify the PRELOADFMT option in the DEFINE statement in order to preload the variable formats. |
wraps the value of a character variable in its column. The FLOW option honors the split character. If the text contains no split character, then PROC REPORT tries to split text at a blank.
Restriction: | This option has no effect on ODS destinations other than traditional SAS monospace output. |
Featured in: | Calculating Percentages |
assigns a SAS or user-defined format to the 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. For data set variables, PROC REPORT honors the first of these formats that it finds:
the format that is assigned with FORMAT= in the DEFINE statement
the format that is assigned in a FORMAT statement when you invoke PROC REPORT
the format that is associated with the variable in the data set.
If none of these formats is present, then PROC REPORT uses BESTw. for numeric variables and $w. for character variables. The value of w is the default column width. For character variables in the input data set, the default column width is the variable's length. For numeric variables in the input data set and for computed variables (both numeric and character), the default column width is the value specified by COLWIDTH= in the PROC REPORT statement or in the ROPTIONS window.
In the interactive report window environment, if you are unsure what format to use, then type a question mark (?) in the format field in the DEFINITION window to access the FORMATS window.
Alias: | F= |
Featured in: | Ordering the Rows in a Report and Displaying Multiple Statistics for One Variable |
defines report-item, which must be a data set variable, as a group variable. (See Group Variables.)
Featured in: | Consolidating Multiple Observations into One Row of a Report, Displaying Multiple Statistics for One Variable, and Using a Format to Create Groups |
specifies that the item that you are defining is an ID variable. An ID variable and all columns to its left appear at the left of every page of a report. ID ensures that you can identify each row of the report when the report contains more columns than will fit on one page.
Featured in: | Displaying Multiple Statistics for One Variable |
references a HELP or CBT entry that contains help information for the report item. Use PROC BUILD in SAS/AF software to create a HELP or CBT entry for a report item. All HELP and CBT entries for a report must be in the same catalog, and you must specify that catalog with the HELP= option in the PROC REPORT statement or from the User Help fields in the ROPTIONS window.
Of course, you can access these entries only from an interactive report window environment. To access a Help entry from the report, select the item and issue the HELP command. PROC REPORT first searches for and displays an entry named entry-name.CBT. If no such entry exists, then PROC REPORT searches for entry-name.HELP. If neither a CBT nor a HELP entry for the selected item exists, then the opening frame of the Help for PROC REPORT is displayed.
left-justifies the formatted values of the report item within the column width and left-justifies the column headings over the values. If the format width is the same as the width of the column, then the LEFT option has no effect on the placement of values.
Restriction | This option only affects the LISTING output. It has no effect on other ODS output. |
considers missing values as valid values for the report item. Special missing values that represent numeric values (the letters A through Z and the underscore (_) character) are each considered as a separate value.
Default: | If you omit the MISSING option, then PROC REPORT excludes from the report and the output data sets all observations that have a missing value for any group, order, or across variable. |
suppresses the display of the report item. Use this option
if you do not want to show the item in the report but you need to use its values to calculate other values that you use in the report
to establish the order of rows in the report
if you do not want to use the item as a column but want to have access to its values in summaries. (See Writing a Customized Summary on Each Page.)
Interaction: | Even though the columns that you define with NOPRINT do not appear in the report, you must count them when you are referencing columns by number. (See Four Ways to Reference Report Items in a Compute Block.) |
Interaction: | SHOWALL in the PROC REPORT statement or the ROPTIONS window overrides all occurrences of NOPRINT. |
Featured in: | Using Aliases to Obtain Multiple Statistics for the Same Variable, Writing a Customized Summary on Each Page, and Creating and Processing an Output Data Set |
suppresses the display of the report item if its values are all zero or missing.
Restriction: | This option has no effect on ODS destinations other than traditional SAS monospace output. |
Interaction: | Even though the columns that you define with NOZERO do not appear in the report, you must count them when you are referencing columns by number. (See Four Ways to Reference Report Items in a Compute Block.) |
Interaction: | SHOWALL in the PROC REPORT statement or in the ROPTIONS window overrides all occurrences of NOZERO. |
defines report-item, which must be a data set variable, as an order variable. (See Order Variables.)
Featured in: | Ordering the Rows in a Report |
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. If no format has been assigned to a class variable, then the default format, BEST12., is used.
orders values by ascending frequency count.
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.
Default: | FORMATTED |
Interaction: | DESCENDING in the item's definition reverses the sort sequence for an item. By default, the order is ascending. |
Featured in: | Ordering the Rows in a Report |
Note: The default value for the ORDER= option in PROC REPORT is not the same as the default value in other SAS procedures. In other SAS procedures, the default is ORDER=INTERNAL. The default for the option in PROC REPORT might change in a future release to be consistent with other procedures. Therefore, in production jobs where it is important to order report items by their formatted values, specify ORDER=FORMATTED even though it is currently the default. Doing so ensures that PROC REPORT will continue to produce the reports you expect even if the default changes.
inserts a page break just before printing the first column containing values of the report item.
Restriction: | This option has no affect on the OUTPUT destination. |
Interaction: | PAGE is ignored if you use WRAP in the PROC REPORT statement or in the ROPTIONS window. |
Tip: | In listing destinations, a PAGE option in the DEFINE statement causes PROC REPORT to print this column and all columns to its right on a new page. However, for ODS MARKUP, HTML, PRINTER , and RTF destinations, the page break does not occur until all the rows in the report have been printed. Therefore, PROC REPORT prints all the rows for all the columns to the left of the PAGE column and then starts over at the top of the report and prints the PAGE column and the columns to the right. |
specifies that the format is preloaded for the variable.
Restriction: | PRELOADFMT applies only to group and across variables. |
Requirement: | PRELOADFMT has no effect unless you specify either EXCLUSIVE or ORDER=DATA and you assign a format to the variable. |
Interaction: | To limit the report to the combination of formatted variable values that are present in the input data set, use the EXCLUSIVE option in the DEFINE statement. |
Interaction |
To include all ranges and values
of the user-defined formats in the output, use the COMPLETEROWS option in
the PROC REPORT statement.
Note: If you do not specify NOCOMPLETECOLS when you define the across variables, then the report includes a column for every formatted variable. If you specify COMPLETEROWS when you define the group variables, then the report includes a row for every formatted value. Some combinations of rows and columns might not make sense when the report includes a column for every formatted value of the across variable and a row for every formatted value of the group variable. |
right-justifies the formatted values of the specified item within the column width and right-justifies the column headings over the values. If the format width is the same as the width of the column, then RIGHT has no effect on the placement of values.
Restriction | This option only affects the LISTING output. It has no affect on other ODS output. |
defines the number of blank characters to leave between the column 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.
Default: | 2 |
Restriction: | This option has no effect on ODS destinations other than traditional SAS monospace output. |
Interaction: | When PROC REPORT's CENTER option is in effect, PROC REPORT ignores spacing that precedes the leftmost variable in the report. |
Interaction: | SPACING= in an item's definition overrides the value of SPACING= in the PROC REPORT statement or in the ROPTIONS window. |
associates a statistic with an analysis variable. You must associate a statistic with every analysis variable in its definition. PROC REPORT uses the statistic that you specify to calculate values for the analysis variable for the observations that are represented by each cell of the report. You cannot use statistic in the definition of any other type of variable.
See Statistics That Are Available in PROC REPORT for a list of available statistics.
Default: | SUM |
Featured in: | Ordering the Rows in a Report, Using Aliases to Obtain Multiple Statistics for the Same Variable, and Consolidating Multiple Observations into One Row of a Report |
Note: PROC REPORT uses the name of the analysis variable as the default heading for the column. You can customize the column heading with the column-header option in the DEFINE statement.
specifies the style element to use for column headings and for text inside cells for this report item. 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 |
specifies a numeric variable whose values weight the values of the analysis variable that is specified in the DEFINE statement. The variable value does not have to be an integer. The following table describes how PROC REPORT treats various values of the WEIGHT variable.
To exclude observations that contain negative and zero weights from the analysis, use the EXCLNPWGT option in the PROC REPORT statement. Note that most SAS/STAT procedures, such as PROC GLM, exclude negative and zero weights by default.
Alias: | WGT= |
Restriction: | to compute weighted quantiles, use QMETHOD=OS in the PROC REPORT statement. |
Tip: | When you use the WEIGHT= option, consider which value of the VARDEF= option in the PROC REPORT statement is appropriate. |
Tip: | Use the WEIGHT= option in separate variable definitions in order to specify different weights for the variables. |
Note: Before Version 7 of SAS, the REPORT procedure did not exclude the observations with missing weights from the count of observations.
defines the width of the column in which PROC REPORT displays report-item.
Default: | A column width that is just large enough to handle the format. If there is no format, then PROC REPORT uses the value of the COLWIDTH= option in the PROC REPORT statement. |
Range: | 1 to the value of the SAS system option LINESIZE= |
Restriction: | This option has no effect on ODS destinations other than traditional SAS monospace output. |
Interaction: | WIDTH= in an item definition overrides the value of COLWIDTH= in the PROC REPORT statement or the ROPTIONS window. |
Tip: | When you stack items in the same column in a report, the width of the item that is at the bottom of the stack determines the width of the column. |
Featured in: | Calculating Percentages |
Copyright © 2010 by SAS Institute Inc., Cary, NC, USA. All rights reserved.