Base SAS 9.1 Procedures Guide, Volumes 1, 2, 3 and 4

Tip: Supports the Output Delivery System. See Output Delivery System on page 32 for details.

ODS Table Name : Report

Reminder: You can use the ATTRIB, FORMAT, LABEL, and WHERE statements. See Chapter 3, Statements with the Same Function in Multiple Procedures, on page 57 for details. You can also use any global statements. See Global Statements on page 18 for a list.

PROC REPORT < option(s) >;

To do this

Use this statement

Produce a default summary at a change in the value of a group or order variable

BREAK

Create a separate report for each BY group

BY

Set the value of an attribute for a particular column in the current row

CALL DEFINE

Describe the arrangement of all columns and of headers that span more than one column

COLUMN

Specify one or more programming statements that PROC REPORT executes as it builds the report

COMPUTE and ENDCOMP

Describe how to use and display a report item

DEFINE

Treat observations as if they appear multiple times in the input data set

FREQ

Provide a subset of features of the PUT statement for writing customized summaries

LINE

Produce a default summary at the beginning or end of a report or at the beginning and end of each BY group

RBREAK

Specify weights for analysis variables in the statistical calculations

WEIGHT

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=

Override the SAS system option THREADS NOTHREADS

THREADS NOTHREADS

Select the windowing or the nonwindowing environment

WINDOWS NOWINDOWS

Use a report that was created before compute blocks required aliases (before Release 6.11)

NOALIAS

Control the statistical analysis

 

Specify the divisor to use in the calculation of variances

VARDEF=

 

Specify the sample size to use for the P 2 quantile estimation method

QMARKERS=

 

Specify the quantile estimation method

QMETHOD=

 

Specify the mathematical definition to calculate quantiles

QNTLDEF=

 

Exclude observations with nonpositive weight values from the analysis.

EXCLNPWGT

Control classification levels

 

Create all possible combinations of the across variable values

COMPLETECOLSNOCOMPLETECOLS

 

Create all possible combinations of the group variable values

COMPLETEROWSNOCOMPLETEROWS

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

CENTERNOCENTER

 

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=

Control ODS output

 

Specify one or more style elements (for the Output Delivery System) to use for different parts of the report

STYLE=

 

Specify text for the HTML or PDF table of contents entry for the output

CONTENTS=

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 that is 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

[*] Traditional SAS monospace output only.

[*] Traditional SAS monospace output only.

[*] Traditional SAS monospace output only.

[*] Traditional SAS monospace output only.

[*] Traditional SAS monospace output only.

[*] Traditional SAS monospace output only.

[*] Traditional SAS monospace output only.

[*] Traditional SAS monospace output only.

[*] Traditional SAS monospace output only.

Options

BOX

CENTERNOCENTER

COLWIDTH= column-width

COMMAND

COMPLETECOLSNOCOMPLETECOLS

COMPLETEROWSNOCOMPLETEROWS

CONTENTS= link-text

DATA= SAS-data-set

EXCLNPWGT

FORMCHAR <( position(s) )>= formatting-character(s)

HEADLINE

HEADSKIP

HELP= libref.catalog

LIST

LS= line-size

MISSING

NAMED

NOALIAS

NOCENTER

NOCOMPLETECOLS

NOCOMPLETEROWS

NOEXEC

NOHEADER

NOTHREADS

NOWINDOWS

OUT= SAS-data-set

OUTREPT= libref.catalog.entry

PANELS= number-of-panels

PCTLDEF=

PROFILE= libref . catalog

PROMPT

PS= page-size

PSPACE= space-between-panels

QMARKERS= number

QMETHOD=OSP2

QNTLDEF=12345

REPORT= libref.catalog.entry

SHOWALL

SPACING= space-between-columns

SPLIT= character

STYLE<( location(s) )>=< style-element-name ><[ style-attribute-specification(s) ]>

THREADS NOTHREADS

VARDEF= divisor

WINDOWSNOWINDOWS

WRAP

BREAK Statement

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.

Featured in: Example 4 on page 971 and Example 5 on page 974.

BREAK location break-variable </ option(s) >;

To do this

Use this option

Specify the color of the break lines in the REPORT window

COLOR=

Double overline each value

DOL [*]

Double underline each value

DUL [*]

Overline each value

OL [*]

Start a new page after the last break line

PAGE

Write a blank line for the last break line

SKIP

Specify a style element for default summary lines, customized summary lines or both

STYLE=

Write a summary line in each group of break lines

SUMMARIZE

Suppress the printing of the value of the break variable in the summary line and of any underlining or overlining in the break lines in the column containing the break variable

SUPPRESS

Underline each value

UL [*]

[*] Traditional SAS monospace output only.

[*] Traditional SAS monospace output only.

[*] Traditional SAS monospace output only.

[*] Traditional SAS monospace output only.

Required Arguments

location

break-variable

Options

COLOR= color

DOL

DUL

OL

PAGE

SKIP

STYLE <location(s)>=<style-element-name><[style-attribute-specification(s)]>

SUMMARIZE

SUPPRESS

UL

Order of Break Lines

When a default summary contains more than one break line, the order in which the break lines appear is

  1. overlining or double overlining (OL or DOL)

  2. summary line (SUMMARIZE)

  3. underlining or double underlining (UL or DUL)

  4. skipped line (SKIP)

  5. page break (PAGE).

Note: If you define a customized summary for the break, then customized break lines appear after underlining or double underlining. For more information about customized break lines, see COMPUTE Statement on page 910 and LINE Statement on page 922.

BY Statement

Creates a separate report on a separate page for each BY group.

Restriction: If you use the BY statement, then you must use the NOWINDOWS option in the PROC REPORT statement.

Restriction: You cannot use the OUT= option when you use a BY statement.

Interaction: If you use the RBREAK statement in a report that uses BY processing, then PROC REPORT creates a default summary for each BY group. In this case, you cannot summarize information for the whole report.

Tip: Using the BY statement does not make the FIRST. and LAST. variables available in compute blocks.

Main discussion: BY on page 58

BY <DESCENDING> variable-1

Required Arguments

variable

Options

DESCENDING

NOTSORTED

CALL DEFINE Statement

Sets the value of an attribute for a particular column in the current row.

Restriction: Valid only in a compute block that is attached to a report item.

Featured in: Example 4 on page 971

CALL DEFINE ( column-id _ROW_ , attribute-name , value );

The CALL DEFINE statement is often used to write report definitions that other people will use in a windowing environment. Only the FORMAT, URL, URLBP, and URLP attributes have an effect in the nonwindowing environment. In fact, URL, URLBP, and URLP are effective only in the nonwindowing environment. The STYLE= and URL attributes are effective only when you are using the Output Delivery System to create HTML, RTF, or Printer output. (See Table 43.6 on page 906 for descriptions of the available attributes.)

Table 43.6: Attribute Descriptions

Attribute

Description

Values

Affects

BLINK

Controls blinking of current value

1 turns blinking on; 0 turns it off

windowing environment

COLOR

Controls the color of the current value in the REPORT window

blue , red , pink , green , cyan , yellow , white , orange , black , magenta , gray , brown

windowing environment

COMMAND

Specifies that a series of commands follows

a quoted string of SAS commands to submit to the command line

windowing environment

FORMAT

Specifies a format for the column

a SAS format or a user-defined format

windowing and nonwindowing environments

HIGHLIGHT

Controls highlighting of the current value

1 turns highlighting on; 0 turns it off

windowing environment

RVSVIDEO

Controls display of the current value

1 turns reverse video on; 0 turns it off

windowing environment

STYLE=

Specifies the style element for the Output Delivery System

See Using the STYLE= Attribute on page 907

HTML, RTF, and Printer output

URL

Makes the contents of each cell of the column a link to the specified Uniform Resource Locator (URL) [*]

a quoted URL (either single or double quotation marks can be used)

HTML, RTF, and Printer output

URLBP

Makes the contents of each cell of the column a link. The link points to a Uniform Resource Locator that is a concatenation of

  1. the string that is specified by the BASE= option in the ODS HTML statement

  2. the string that is specified by the PATH= option in the ODS HTML statement

  3. the value of the URLBP attribute [*] , [#]

a quoted URL (either single or double quotation marks can be used)

HTML output

URLP

Makes the contents of each cell of the column a link. The link points to a Uniform Resource Locator that is a concatenation of

  1. the string that is specified by the PATH= option in the ODS HTML statement

  2. the value of the URLP attribute [*] , [#]

a quoted URL (either single or double quotation marks can be used)

HTML output

[*] The total length of the URL that you specify (including any characters that come from the BASE= and PATH= options) cannot exceed the line size. Use the LS= option in the PROC REPORT statement to alter the line size for the PROC REPORT step.

[*] The total length of the URL that you specify (including any characters that come from the BASE= and PATH= options) cannot exceed the line size. Use the LS= option in the PROC REPORT statement to alter the line size for the PROC REPORT step.

[#] For information on the BASE= and PATH= options, see the documentation for the ODS HTML statement in The Complete Guide to the SAS Output Delivery System .

[*] The total length of the URL that you specify (including any characters that come from the BASE= and PATH= options) cannot exceed the line size. Use the LS= option in the PROC REPORT statement to alter the line size for the PROC REPORT step.

[#] For information on the BASE= and PATH= options, see the documentation for the ODS HTML statement in The Complete Guide to the SAS Output Delivery System .

Required Arguments

column-id

attribute-name

_ROW_

value

Note: The attributes BLINK, HIGHLIGHT, and RVSVIDEO do not work on all devices.

Using the STYLE= Attribute

The STYLE= attribute specifies the style element to use in the cells that are affected by the CALL DEFINE statement.

The STYLE= attribute functions like the STYLE= option in other statements in PROC REPORT. However, instead of acting as an option in a statement, it becomes the value for the STYLE= attribute. For instance, the following CALL DEFINE statement sets the background color to yellow and the font size to 7 for the specified column:

call define(_col_, "style", "style=[background=yellow font_size=7]");

See Using Style Elements in PROC REPORT on page 879 for details.

COLUMN Statement

Describes the arrangement of all columns and of headers that span more than one column.

Restriction: You cannot use the COLUMN statement if you use REPORT= in the PROC REPORT statement.

Featured in: Example 1 on page 962, Example 3 on page 968, Example 5 on page 974, Example 6 on page 978, Example 10 on page 989, and Example 11 on page 992

COLUMN column-specification(s) ;

Required Arguments

column-specification(s)

Note: You cannot always use an alias. When you refer in a compute block to a report item that has an alias, you must usually 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 on page 875).

COMPUTE Statement

Starts a compute block . A compute block contains one or more programming statements that PROC REPORT executes as it builds the report.

Interaction: An ENDCOMP statement must mark the end of the group of statements in the compute block.

Featured in: Example 2 on page 965, Example 3 on page 968, Example 4 on page 971, Example 5 on page 974, Example 9 on page 986, and Example 10 on page 989

COMPUTE location < target >

COMPUTE report-item </ type-specification >;

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 on page 874.

Required Arguments

You must specify either a location or a report item in the COMPUTE statement.

location

report-item

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

STYLE<( location(s) )>=< style-element-name ><[ style-attribute-specification(s) ]>

target

type-specification

DEFINE Statement

Describes how to use and display a report item.

Tip: If you do not use a DEFINE statement, then PROC REPORT uses default characteristics.

Featured in: Example 2 on page 965, Example 3 on page 968, Example 4 on page 971, Example 5 on page 974, Example 6 on page 978, Example 9 on page 986, and Example 10 on page 989

DEFINE report-item /< option(s) >;

To do this

Use this option

Specify how to use a report item (see Usage of Variables in a Report on page 869)

 

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

 

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 headers

 

Center the formatted values of the report item within the column width and center the column header over the values

CENTER

 

Left-justify the formatted values of the report item within the column width and left-justify the column headers over the values

LEFT

 

Right-justify the formatted values of the report item within the column width and right-justify the column headers over the values

RIGHT

 

Specify the color in the REPORT window of the column header and of the values of the item that you define

COLOR=

 

Define the column header for the report item

column-header

Required Arguments

report-item

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

ACROSS

ANALYSIS

CENTER

COLOR= color

column-header

COMPUTED

DESCENDING

DISPLAY

EXCLUSIVE

FLOW

FORMAT= format

GROUP

ID

ITEMHELP= entry-name

LEFT

MISSING

NOPRINT

NOZERO

ORDER

ORDER=DATAFORMATTEDFREQINTERNAL

PAGE

PRELOADFMT

RIGHT

SPACING= horizontal-positions

statistic

STYLE<( location(s) )>=< style-element-name ><[ style-attribute-specification(s) ]>

WEIGHT= weight-variable

WIDTH= column-width

ENDCOMP Statement

Marks the end of one or more programming statements that PROC REPORT executes as it builds the report.

Restriction: A COMPUTE statement must precede the ENDCOMP statement.

ENDCOMP ;

FREQ Statement

Treats observations as if they appear multiple times in the input data set.

Tip: The effects of the FREQ and WEIGHT statements are similar except when calculating degrees of freedom.

See also: For an example that uses the FREQ statement, see Example on page 62

FREQ variable ;

Required Arguments

variable

Frequency Information Is Not Saved

When you store a report definition, PROC REPORT does not store the FREQ statement.

LINE Statement

Provides a subset of the features of the PUT statement for writing customized summaries.

Restriction: This statement is valid only in a compute block that is associated with a location in the report.

Restriction: You cannot use the LINE statement in conditional statements (IF-THEN, IF-THEN/ELSE, and SELECT) because it is not executed until PROC REPORT has executed all other statements in the compute block.

Featured in: Example 2 on page 965, Example 3 on page 968, and Example 9 on page 986

LINE specification(s) ;

Required Arguments

specification(s)

Differences between the LINE and PUT Statements

The LINE statement does not support the following features of the PUT statement:

RBREAK Statement

Produces a default summary at the beginning or end of a report or at the beginning or end of each BY group.

Featured in: Example 1 on page 962 and Example 10 on page 989

RBREAK location </ option(s) >;

To do this

Use this option

Specify the color of the break lines in the REPORT window

COLOR=

Double overline each value

DOL [*]

Double underline each value

DUL [*]

Overline each value

OL [*]

Start a new page after the last break line of a break located at the beginning of the report

PAGE

Write a blank line for the last break line of a break located at the beginning of the report

SKIP [*]

Specify a style element (for the Output Delivery System) for default summary lines, customized summary lines, or both

STYLE=

Include a summary line as one of the break lines

SUMMARIZE

Underline each value

UL [*]

[*] Traditional SAS monospace output only.

[*] Traditional SAS monospace output only.

[*] Traditional SAS monospace output only.

[*] Traditional SAS monospace output only.

[*] Traditional SAS monospace output only.

Required Arguments

location

Options

COLOR= color

DOL

DUL

OL

PAGE

SKIP

STYLE<( location(s) )>=< style-element-name ><[ style-attribute-specification(s) ]>

SUMMARIZE

UL

Order of Break Lines

When a default summary contains more than one break line, the order in which the break lines appear is

  1. overlining or double overlining (OL or DOL, traditional SAS monospace output only)

  2. summary line (SUMMARIZE)

  3. underlining or double underlining (UL or DUL, traditional SAS monospace output only)

  4. skipped line (SKIP, traditional SAS monospace output only)

  5. page break (PAGE).

Note: If you define a customized summary for the break, then customized break lines appear after underlining or double underlining. For more information about customized break lines, see COMPUTE Statement on page 910 and LINE Statement on page 922.

WEIGHT Statement

Specifies weights for analysis variables in the statistical calculations.

See also: For information about calculating weighted statistics see Calculating Weighted Statistics on page 64. For an example that uses the WEIGHT statement, see Weighted Statistics Example on page 65.

WEIGHT variable ;

Required Arguments

variable

Weight Information Is Not Saved

When you store a report definition, PROC REPORT does not store the WEIGHT statement.

Категории