Chapter Contents

Previous

Next
The REPORT Procedure

PROC REPORT Statement


PROC REPORT <option(s)>;

To do this Use this option
Specify the input data set DATA=
Specify the output data set OUT=
Select the windowing or the nonwindowing environment WINDOWS| NOWINDOWS
Specify the divisor to use in the calculation of variances VARDEF=
Exclude observations with nonpositive weight values from the analysis. EXCLNPWGT
Use a report that was created before compute blocks required aliases (before Release 6.11) NOALIAS
Specify one or more style elements (for the Output Delivery System) to use for different parts of the report STYLE=
Control the layout of the report

Use formatting characters to add line-drawing characters to the report BOX

Specify whether to center or left-justify the report and summary text CENTER|NOCENTER

Specify the default number of characters for columns containing computed variables or numeric data set variables COLWIDTH=

Define the characters to use as line-drawing characters in the report FORMCHAR=

Specify the length of a line of the report LS=

Consider missing values as valid values for group, order, or across variables MISSING

Specify the number of panels on each page of the report PANELS=

Specify the number of lines in a page of the report PS=

Specify the number of blank characters between panels PSPACE=

Override options in the DEFINE statement that suppress the display of a column SHOWALL

Specify the number of blank characters between columns SPACING=

Display one value from each column of the report, on consecutive lines if necessary, before displaying another value from the first column WRAP
Customize column headers

Underline all column headers and the spaces between them HEADLINE

Write a blank line beneath all column headers HEADSKIP

Suppress column headers NOHEADER

Write name= in front of each value in the report, where name= is the column header for the value NAMED

Specify the split character SPLIT=
Store and retrieve report definitions, PROC REPORT statements, and your report profile

Write to the SAS log the PROC REPORT code that creates the current report LIST

Suppress the building of the report NOEXEC

Store in the specified catalog the report definition defined by the PROC REPORT step that you submit OUTREPT=

Identify the report profile to use PROFILE=

Specify the report definition to use REPORT=
Control the windowing environment

Display command lines rather than menu bars in all REPORT windows COMMAND

Identify the library and catalog containing user-defined help for the report HELP=

Open the REPORT window and start the PROMPT facility PROMPT


Options

BOX
uses formatting characters to add line-drawing characters to the report. These characters

Restriction: This option has no effect on the HTML or Printer output.
Interaction: You cannot use BOX if you use WRAP in the PROC REPORT statement or in the ROPTIONS window or if you use FLOW in any item definition.
See also: the discussion of FORMCHAR=
Featured in: Creating and Processing an Output Data Set

CENTER|NOCENTER
specifies whether to center or left-justify the report and summary text (customized break lines).

PROC REPORT honors the first of these centering specifications that it finds:

Restriction: This option has no effect on the HTML or Printer output.
Interaction: When CENTER is in effect, PROC REPORT ignores spacing that precedes the leftmost variable in the report.

COLWIDTH=column-width
specifies the default number of characters for columns containing computed variables or numeric data set variables.
Default: 9
Range: 1 to the linesize
Restriction: This option has no effect on the HTML or Printer output.
Interaction: When setting the width for a column, PROC REPORT first looks at WIDTH= in the definition for that column. If WIDTH= is not present, PROC REPORT uses a column width large enough to accommodate the format for the item. (For information about formats see the discussion of FORMAT= .)
If no format is associated with the item, the column width depends on variable type:

If the variable is a ... Then the column width is the ...
character variable in the input data set length of the variable
numeric variable in the input data set value of the COLWIDTH= option
computed variable (numeric or character) value of the COLWIDTH= option

Featured in: Ordering the Rows in a Report

COMMAND
displays command lines rather than menu bars in all REPORT windows.

After you have started PROC REPORT in the windowing environment, you can display the menu bars in the current window by issuing the COMMAND command. You can display the menu bars in all PROC REPORT windows by issuing the PMENU command. The PMENU command affects all the windows in your SAS session. Both of these commands are toggles.

You can store a setting of COMMAND in your report profile. PROC REPORT honors the first of these settings that it finds:

Restriction: This option has no effect in the nonwindowing environment.

DATA=SAS-data-set
specifies the input data set.
Main discussion: Input Data Sets

EXCLNPWGT
excludes observations with nonpositive weight values (zero or negative) from the analysis. By default, PROC REPORT treats observations with negative weights like those with zero weights and counts them in the total number of observations.
Alias: EXCLNPWGTS
Requirement: You must use a WEIGHT statement.
See also: WEIGHT Statement

FORMCHAR <(position(s))>='formatting-character(s)'
defines the characters to use as line-drawing characters in the report.

position(s)
identifies the position of one or more characters in the SAS formatting-character string. A space or a comma separates the positions.
Default: Omitting (position(s)) is the same as specifying all 20 possible SAS formatting characters, in order.
Range: PROC REPORT uses 12 of the 20 formatting characters that SAS provides. Formatting Characters Used by PROC REPORT shows the formatting characters that PROC REPORT uses. Formatting Characters in PROC REPORT Output illustrates the use of some commonly used formatting character in the output from PROC REPORT.

formatting-character(s)
lists the characters to use for the specified positions. PROC REPORT assigns characters in formatting-character(s) to position(s), in the order that they are listed. For instance, the following option assigns the asterisk (*) to the third formatting character, the pound sign (#) to the seventh character, and does not alter the remaining characters:
formchar(3,7)='*#'

Restriction: This option has no effect on the HTML or Printer output.
Interaction: The SAS system option FORMCHAR= specifies the default formatting characters. The system option defines the entire string of formatting characters. The FORMCHAR= option in a procedure can redefine selected characters.
Tip: You can use any character in formatting-characters, including hexadecimal characters. If you use hexadecimal characters, you must put an x after the closing quote. For instance, the following option assigns the hexadecimal character 2D to the third formatting character, the hexadecimal character 7C to the seventh character, and does not alter the remaining characters:
formchar(3,7)='2D7C'x

Formatting Characters Used by PROC REPORT
Position Default Used to draw
1 | the right and left borders and the vertical separators between columns
2 - the top and bottom borders and the horizontal separators between rows; also underlining and overlining in break lines as well as the underlining that the HEADLINE option draws
3 - the top character in the left border
4 - the top character in a line of characters that separates columns
5 - the top character in the right border
6 | the leftmost character in a row of horizontal separators
7 + the intersection of a column of vertical characters and a row of horizontal characters
8 | the rightmost character in a row of horizontal separators
9 - the bottom character in the left border
10 - the bottom character in a line of characters that separate columns
11 - the bottom character in the right border
13 = double overlining and double underlining in break lines

Formatting Characters in PROC REPORT Output

[IMAGE]

HEADLINE
underlines all column headers and the spaces between them at the top of each page of the report.

The HEADLINE option underlines with the second formatting character. (See the discussion of FORMCHAR= .)
Default: hyphen (-)
Restriction: This option has no effect on the HTML or Printer output.
Tip: In traditional (monospace) SAS output, you can underline column headers without underlining the spaces between them, by using two hyphens ('--') as the last line of each column header instead of using HEADLINE.
Featured in: Ordering the Rows in a Report and Condensing a Report into Multiple Panels

HEADSKIP
writes a blank line beneath all column headers (or beneath the underlining that the HEADLINE option writes) at the top of each page of the report.
Restriction: This option has no effect on the HTML or Printer output.
Featured in: Ordering the Rows in a Report

HELP=libref.catalog
identifies the library and catalog containing user-defined help for the report. This help can be in CBT or HELP catalog entries. You can write a CBT or HELP entry for each item in the report with the BUILD procedure in SAS/AF software. Store all such entries for a report in the same catalog.

Specify the entry name for help for a particular report item in the DEFINITION window for that report item or in a DEFINE statement.
Restriction: This option has no effect in the nonwindowing environment or on the HTML or Printer output.

LIST
writes to the SAS log the PROC REPORT code that creates the current report. This listing may differ in these ways from the statements that you submit:

Restriction: This option has no effect in the windowing environment. Selecting

Tools
[arrow]
Report Statements
serves a similar purpose. It writes the report definition for the report that is currently in the REPORT window to the SOURCE window.

LS=line-size
specifies the length of a line of the report.

PROC REPORT honors the first of these line size specifications that it finds:

Range: 64-256 (integer)
Restriction: This option has no effect on the HTML or Printer output.
Featured in: Displaying Multiple Statistics for One Variable and Condensing a Report into Multiple Panels

MISSING
considers missing values as valid values for group, order, or across variables. Special missing values used to represent numeric values (the letters A through Z and the underscore (_) character) are each considered as a different value. A group for each missing value appears in the report. If you omit the MISSING option, PROC REPORT does not include observations with a missing value for any group, order, or across variables in the report.
See also: For information about special missing values, see the section on missing values in SAS Language Reference: Concepts.
Featured in: How PROC REPORT Handles Missing Values

NAMED
writes name= in front of each value in the report, where name is the column header for the value.
Interaction: When you use the NAMED option, PROC REPORT automatically uses the NOHEADER option.
Tip: Use NAMED in conjunction with the WRAP option to produce a report that wraps all columns for a single row of the report onto consecutive lines rather than placing columns of a wide report on separate pages.
Featured in: Storing and Reusing a Report Definition

lets you use a report that was created before compute blocks required aliases (before Release 6.11). If you use NOALIAS, you cannot use aliases in compute blocks.

NOCENTER
See CENTER|NOCENTER .

NOEXEC
suppresses the building of the report. Use NOEXEC with OUTREPT= to store a report definition in a catalog entry. Use NOEXEC with LIST and REPORT= to display a listing of the specified report definition.

NOHEADER
suppresses column headers, including those that span multiple columns.

Once you suppress the display of column headers in the windowing environment, you cannot select any report items.

NOWINDOWS
Alias: NOWD
See WINDOWS|NOWINDOWS .

OUT=SAS-data-set
names the output data set. If this data set does not exist, PROC REPORT creates it. The data set contains one observation for each detail row of the report and one observation for each unique summary line. If you use both customized and default summaries at the same place in the report, the output data set contains only one observation because the two summaries differ only in how they present the data. Information about customization (underlining, color, text, and so forth) is not data and is not saved in the output data set.

The output data set contains one variable for each column of the report. PROC REPORT tries to use the name of the report item as the name of the corresponding variable in the output data set. However, this is not possible if a data set variable is under or over an across variable or if a data set variable appears multiple times in the COLUMN statement without aliases. In these cases, the name of the variable is based on the column number (_C1_, _C2_, and so forth).

Output data set variables that are derived from input data set variables retain the formats of their counterparts in the input data set. PROC REPORT derives labels for these variables from the corresponding column headers in the report unless the only item defining the column is an across variable. In that case, the variables have no label. If multiple items are stacked in a column, the labels of the corresponding output data set variables come from the analysis variable in the column.

The output data set also contains a variable named _BREAK_. If an observation in the output data set derives from a detail row in the report, the value of _BREAK_ is missing. If it derives from a summary line, the value of _BREAK_ is the name of the break variable associated with the summary line, or _RBREAK_.
Interaction: You cannot use OUT= in a PROC REPORT step that uses a BY statement.
Featured in: Creating and Processing an Output Data Set and Storing Computed Variables as Part of a Data Set

OUTREPT=libref.catalog.entry
stores in the specified catalog entry the REPORT definition defined by the PROC REPORT step that you submit. PROC REPORT assigns the entry a type of REPT.

The stored report definition may differ in these ways from the statements that you submit:

Featured in: Storing and Reusing a Report Definition

PANELS=number-of-panels
specifies the number of panels on each page of the report. If the width of a report is less than half of the line size, you can display the data in multiple sets of columns so that rows that would otherwise appear on multiple pages appear on the same page. Each set of columns is a panel. A familiar example of this kind of report is a telephone book, which contains multiple panels of names and telephone numbers on a single page.

When PROC REPORT writes a multipanel report, it fills one panel before beginning the next.

The number of panels that fits on a page depends on the

Restriction: This option has no effect on the HTML or Printer destination.
Default: 1
Tip: If number-of-panels is larger than the number of panels that can fit on the page, PROC REPORT creates as many panels as it can. Let PROC REPORT put your data in the maximum number of panels that can fit on the page by specifying a large number of panels (for example, 99).
See also: For information about the space between panels and the line size, see the discussions of PSPACE= and the discussion of LS= .
Featured in: Condensing a Report into Multiple Panels

PROFILE=libref.catalog
identifies the report profile to use. A profile

PROC REPORT uses the entry REPORT.PROFILE in the catalog that you specify as your profile. If no such entry exists, or if you do not specify a profile, PROC REPORT uses the entry REPORT.PROFILE in SASUSER.PROFILE. If you have no profile, PROC REPORT uses default menus and the default settings of the options.

You create a profile from the PROFILE window while using PROC REPORT in a windowing environment. To create a profile

  1. Invoke PROC REPORT with the WINDOWS option.

  2. Select ToolsReport Profile.

  3. Fill in the fields to suit your needs.

  4. Select [OK] to exit the PROFILE window. When you exit the window, PROC REPORT stores the profile in SASUSER.PROFILE.REPORT.PROFILE. Use the CATALOG procedure or the Explorer window to copy the profile to another location.

    Note:   If you open the PROFILE window and decide not to create a profile, select [CANCEL] to close the window.  [cautionend]

PROMPT
opens the REPORT window and starts the PROMPT facility. This facility guides you through creating a new report or adding more data set variables or statistics to an existing report.

If you start PROC REPORT with prompting, the first window gives you a chance to limit the number of observations that are used during prompting. When you exit the prompter, PROC REPORT removes the limit.
Restriction: When you use the PROMPT option, you open the REPORT window. When the REPORT window is open, you cannot send procedure output to the HTML or Printer destination.
Tip: You can store a setting of PROMPT in your report profile. PROC REPORT honors the first of these settings that it finds:

If you omit PROMPT from the PROC REPORT statement, the procedure uses the setting in your report profile, if you have one. If you do not have a report profile, PROC REPORT does not use the prompt facility. For information on report profiles, see PROFILE .

PS=page-size
specifies the number of lines in a page of the report.

PROC REPORT honors the first of these page size specifications that it finds:

Range: 15-32,767 (integer)
Restriction: This option has no effect on the HTML or Printer output.
Featured in: Displaying Multiple Statistics for One Variable and Condensing a Report into Multiple Panels

PSPACE=space-between-panels
specifies the number of blank characters between panels. PROC REPORT separates all panels in the report by the same number of blank characters. For each panel, the sum of its width and the number of blank characters separating it from the panel to its left cannot exceed the line size.
Default: 4
Restriction: This option has no effect on the HTML or Printer output.
Featured in: Condensing a Report into Multiple Panels

REPORT=libref.catalog.entry
specifies the report definition to use. PROC REPORT stores all report definitions as entries of type REPT in a SAS catalog.
Interaction: If you use REPORT=, you cannot use the COLUMN statement.
See also: OUTREPT=
Featured in: Storing and Reusing a Report Definition

SHOWALL
overrides options in the DEFINE statement that suppress the display of a column.
See also: NOPRINT and NOZERO in DEFINE Statement

SPACING=space-between-columns
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.
Default: 2
Restriction: This option has no effect on the HTML or Printer output.
Interaction: PROC REPORT separates all columns in the report by the number of blank characters specified by SPACING= in the PROC REPORT statement unless you use SPACING= in the DEFINE statement to change the spacing to the left of a specific item.
Interaction: When CENTER is in effect, PROC REPORT ignores spacing that precedes the leftmost variable in the report.
Featured in: Ordering the Rows in a Report

SPLIT='character'
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 counts toward the 256-character maximum for a label.
Default: slash (/)
Interaction: The FLOW option in the DEFINE statement honors the split character.
Featured in: Creating a Column for Each Value of a Variable

STYLE<(location(s))>=<style-element-name><[style-attribute-specification(s)]>
specifies the style element to use for the specified locations in the report.

Note:   You can use braces ({ and }) instead of square brackets ([ and ]).  [cautionend]

location
identifies the part of the report that the STYLE= option affects. Specifying Locations in the STYLE= Option shows the available locations and the other statements that you can specify them in. Specifications in a statement other than the PROC REPORT statement override the same specification in the PROC REPORT statement. However, any style attributes that you specify in the PROC REPORT statement and do not override in another statement are inherited. For instance, if you specify a blue background and a white foreground for all column headers in the PROC REPORT statement, and you specify a gray background for the column headers of a variable in the DEFINE statement, the background for that particular column header is gray, and the foreground is white (as specified in the PROC REPORT statement).

Specifying Locations in the STYLE= Option
This location Affects this part of the report And can also be specified for individual items in this statement
CALLDEF all cells that are identified by a CALL DEFINE statement CALL DEFINE
COLUMN the cells of all columns DEFINE
HEADER all column headers and all spanning headers DEFINE (for column headers)
LINES all LINE statements in all compute blocks COMPUTE (with one or more LINE statements)
REPORT the structural part of the report, that is, the underlying table. Use REPORT to set things such as the width of the border and the space between cells none
SUMMARY all default summary lines produced by a BREAK or an RBREAK statement
BREAK
RBREAK

style-element-name
is the name of a style element that is part of a style definition that is registered with the Output Delivery System. SAS Institute provides some style definitions. Users can create their own style definitions with PROC TEMPLATE. For information about Institute-supplied style definitions, see What Style Definitions Are Shipped with the Software? . For information about PROC TEMPLATE and the Output Delivery System, see The Complete Guide to the SAS Output Delivery System.
Default: The Default Style Element for Each Location in PROC REPORT shows the default style element for each location:

The Default Style Element for Each Location in PROC REPORT
Location Default style element
CALLDEF Data
COLUMN Data
HEADER Header
LINES NoteContent
REPORT Table
SUMMARY DataEmphasis

style-attribute-specification
describes the style attribute to change. Each style-attribute-specification has this general form:
style-attribute-name=style-attribute-value

You can set these style attributes in the REPORT location:

BACKGROUND= FONT_WIDTH=*
BACKGROUNDIMAGE= FOREGROUND=*
BORDERCOLOR= FRAME=
BORDERCOLORDARK= HTMLCLASS=
BORDERCOLORLIGHT= JUST=
BORDERWIDTH= OUTPUTWIDTH=
CELLPADDING= POSTHTML=
CELLSPACING= POSTIMAGE=
FONT=* POSTTEXT=
FONT_FACE=* PREHTML=
FONT_SIZE=* PREIMAGE=
FONT_STYLE=* PRETEXT=
FONT_WEIGHT=* RULES=
*When you use these attributes in this location, they affect only the text that is specified with the PRETEXT=, POSTTEXT=, PREHTML=, and POSTHTML= attributes. To alter the foreground color or the font for the text that appears in the table, you must set the corresponding attribute in a location that affects the cells rather than the table.

You can set these style attributes in the CALLDEF, COLUMN, HEADER, LINES, and SUMMARY locations:

ASIS= FONT_WIDTH=
BACKGROUND= HREFTARGET=
BACKGROUNDIMAGE= HTMLCLASS=
BORDERCOLOR= JUST=
BORDERCOLORDARK= NOBREAKSPACE=
BORDERCOLORLIGHT= POSTHTML=
BORDERWIDTH= POSTIMAGE=
CELLHEIGHT= POSTTEXT=
CELLWIDTH= PREHTML=
FLYOVER= PREIMAGE=
FONT= PRETEXT=
FONT_FACE= PROTECTSPECIALCHARS=
FONT_SIZE= TAGATTR=
FONT_STYLE= URL=
FONT_WEIGHT= VJUST=

For information about style attributes, see What Style Attributes Can Base Procedures Specify? .

Restriction: This option affects only the HTML and Printer output.
Featured in: Specifying Style Elements for HTML Output in the PROC REPORT Statement and Specifying Style Elements for HTML Output in Multiple Statements

VARDEF=divisor
specifies the divisor to use in the calculation of the variance and standard deviation. Possible Values for VARDEF= shows the possible values for divisor and associated divisors.

Possible Values for VARDEF=
Value Divisor Formula for Divisor
DF degrees of freedom n - 1
N number of observations n
WDF sum of weights minus one ([Sigma]iwi) - 1
WEIGHT|WGT sum of weights [Sigma]iwi

The procedure computes the variance as [IMAGE], where [IMAGE] is the corrected sums of squares and equals [IMAGE]. When you weight the analysis variables, [IMAGE] equals [IMAGE], where [IMAGE] is the weighted mean.
Default: DF
Requirement: To compute the standard error of the mean and Student's t-test, use the default value of VARDEF=.
Tip: When you use the WEIGHT statement and VARDEF=DF, the variance is an estimate of [IMAGE], where the variance of the ith observation is [IMAGE] and [IMAGE] is the weight for the ith observation. This yields an estimate of the variance of an observation with unit weight.
Tip: When you use the WEIGHT statement and VARDEF=WGT, the computed variance is asymptotically (for large n) an estimate of [IMAGE], where [IMAGE] is the average weight. This yields an asymptotic estimate of the variance of an observation with average weight.
See also: WEIGHT

WINDOWS|NOWINDOWS
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 output to the SAS procedure output.
Alias: WD|NOWD
Restriction: When you use the WINDOWS option, you cannot send procedure output to the HTML or Printer destination.
Tip: You can store a setting of WINDOWS in your report profile, if you have one. If you do not specify WINDOWS or NOWINDOWS in the PROC REPORT statement, the procedure uses the setting in your report profile. If you do not have a report profile, PROC REPORT looks at the setting of the SAS system option DMS. If DMS is ON, PROC REPORT uses the windowing environment; if DMS is OFF, it uses the nonwindowing environment.
See also: For a discussion of the report profile see the discussion of PROFILE= .
Featured in: Selecting Variables for a Report

WRAP
displays one value from each column of the report, on consecutive lines if necessary, before displaying another value from the first column. By default, PROC REPORT displays values for only as many columns as it can fit on one page. It fills a page with values for these columns before starting to display values for the remaining columns on the next page.
Restriction: This option has no effect on the HTML or Printer output.
Interaction: When WRAP is in effect, PROC REPORT ignores PAGE in any item definitions.
Tip: Typically, you use WRAP in conjunction with the NAMED option in order to avoid wrapping column headers.
Featured in: Storing and Reusing a Report Definition


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.