Chapter 8. Creating Enhanced List and Summary Reports

Overview

Introduction

List and summary reports are often created from SAS data. To produce a variety of reports using a single report-writing tool, you can use PROC REPORT. In addition to creating list reports, PROC REPORT enables you to

  • create custom reports

  • request separate subtotals and grand totals

  • calculate columns

  • create and store report definitions.

You can use PROC REPORT in three ways:

  • in windowing mode with a prompting facility that guides you as you build a report

  • in windowing mode without the prompting facility

  • in nonwindowing mode. In this case, you submit a series of statements with the PROC REPORT statement, just as you do in other SAS procedures.

Introduction

This chapter shows you how to use PROC REPORT by submitting SAS statements. Although PROC REPORT enables you to create highly customized reports, we'll focus on basic statements and will add a few enhancements. By the end of the chapter, you'll create a list report and a summary report.

Introduction

Objectives

In this chapter, you learn to

  • invoke the REPORT procedure

  • select columns for your report

  • define the usage for columns

  • specify attributes, options, and justification for columns

  • specify features of column headings, including split characters, underlining, and blank lines.

Creating a Default List Report

Let's start by creating a list report. Suppose you want to create a listing of mail, freight, and passenger revenue for flights between LaGuardia Airport and London or Paris.

As with other SAS procedures, you first reference the library in which your data is stored. Then you submit a basic PROC REPORT step.

Example

In this program, PROC REPORT reads the Flights.Europe data set and creates a report in nonwindowing mode:

proc report data=flights.europe nowd;
run;

This is HTML output from the PROC REPORT step. Notice that by default

  • all observations and variables in the data set are printed

  • variables appear in the order in which they occur in the data set.

Example

Selecting Variables

Now let's see how you can choose the data that you want to display.

To select and order the variables that appear in your list report, you can use the COLUMN statement.

Example

The following COLUMN statement specifies that only the variables Flight, Orig, Dest, Mail, Freight, and Revenue be printed, in that order.

proc report data=flights.europe nowd;
   column flight orig dest mail freight revenue;
run;
Example

Selecting Observations

You might also want to select rows for your report based on a condition. To select observations, you can use the WHERE statement, just as you have learned to do with PROC PRINT.

Example

The following WHERE statement specifies that only observations that have the value LON or PAR for the variable Dest be printed.

proc report data=flights.europe nowd;
   column flight orig dest mail freight revenue;
   where dest in ('LON','PAR'),
run;
Example

Defining Variables

Overview of Defining Variables

In the output that you've seen in this chapter so far, you might have noticed that PROC REPORT displays

  • each data value the way it is stored in the data set

  • variable names as column headings in the report

  • a default width for the report columns

  • left-justified character values

  • right-justified numeric values

  • observations in the order in which they are stored in the data set.

Overview of Defining Variables

You can enhance the report by

  • defining how each variable is used in the report

  • assigning formats to variables

  • specifying column headings and widths

  • justifying the variable values and column headings within the report columns

  • changing the order of the rows in the report.

Let's see how to define variables.

Using DEFINE Statements

To describe how to use and display variables in your report, you use one or more DEFINE statements. You can list DEFINE statements in any order, and you can list options (usages, attributes, and so on) in any order in a DEFINE statement.

Example

These DEFINE statements specify usages, attributes, options, justification, and column headings for the variables Flight and Orig. In this chapter, you'll look at each of these ways of defining variables.

proc report data=flights.europe nowd;
   where dest in ('LON','PAR'),
   column flight orig dest mail freight revenue;
   define flight / order descending 'Flight Number' 
                center width=6 spacing=5; 
   define orig / 'Flight Origin' center width=6;
run;

Let's start with attributes.

Defining Column Attributes

You can easily change the appearance of your PROC REPORT output by specifying attributes for variables. For example, you can select a format for data values, specify the column width, and specify the spacing between columns.

To enhance your PROC REPORT output, you'll use the following attributes.

Attribute

Action

FORMAT=format

Assigns a SAS format or a user-defined format to the item.

SPACING=horizontal-positions

Specifies how many blank characters to leave between the selected column and the column immediately to its left. The default is 2.

WIDTH=column-width

Specifies the width of the column. The default column width is just large enough to handle the specified format.

Let's begin with the FORMAT= attribute.

Assigning Formats

In previous chapters, you learned that formats determine how data values appear in SAS output. If you do not specify a format for a variable within the PROC REPORT step, PROC REPORT uses the format that is stored in the data set. If no format is stored in the data set, PROC REPORT uses the default format for that variable type.

To assign a format to a specific report column, use the FORMAT= attribute in the DEFINE statement for that column. You can specify any appropriate SAS format or user-defined format.

Example

The variable Revenue has no format assigned to it in the Flights.Europe data set. So, in your current report, revenue values appear as shown in the example below.

Example

But suppose you want your revenue figures to be formatted with a dollar sign, commas, and two decimal places, in a total width of 15 positions. To do this, you can assign the DOLLAR15.2 format to Revenue.

proc report data=flights.europe nowd;
   where dest in ('LON','PAR'),
   column flight orig dest mail freight revenue;
   define revenue / format=dollar15.2;
run;

This is part of the HTML output from the program above. Notice that the format supplies the dollar sign, comma, decimal point, and decimal places. However, because the HTML table column conforms to the width of its contents, assigning the format does not increase the column width beyond the length of the data values.

Example

By contrast, the monospace SAS listing of the report does display the increased column width.

Example
Example

Specifying Column Widths

In the previous example of SAS listing output, you might have noticed that several headings were wrapped over two lines. (In HTML output, the longest cell value determines the column width, so wrapping doesn't occur.)

If a variable in the input data set doesn't have a format associated with it, the default PROC REPORT column width is

  • the variable's length for character variables

  • 9 for numeric variables.

The character variables Flight, Orig, and Dest each have a length of 3, and no format is associated with them. So 3 is their default column width.

Specifying Column Widths

To specify a width for columns in your report, use the WIDTH= attribute in the DEFINE statement. You can specify values from 1 to the value of the LINESIZE= system option.

The WIDTH= attribute has no effect on HTML output.

Example

To specify column widths that accommodate the column headings for Flight, Orig, and Dest, you can use the following DEFINE statements in your PROC REPORT step:

proc report data=flights.europe nowd;
   where dest in ('LON','PAR'),
   column flight orig dest mail freight revenue;
   define revenue / format=dollar15.2;
   define flight / width=6; 
   define orig / width=4; 
   define dest / width=4;
run;

Now the headings appear on one line.

Example

Specifying Column Spacing

Another way to enhance your PROC REPORT output is to specify column spacing, which is the number of blank characters between the selected column and the column immediately to its left. The default column spacing is 2. To specify a different column spacing, use the SPACING= attribute in the DEFINE statement.

The SPACING= attribute has no effect on HTML output.

Example

This is PROC REPORT output without any spacing defined. Orig and Dest have 2 blank characters preceding their columns.

Example

To specify 5 blank spaces before the column headings for Orig and Dest, you can use DEFINE statements as shown below in your PROC REPORT step:

proc report data=flights.europe nowd;
   where dest in ('LON','PAR'),
   column flight orig dest mail freight revenue;
   define revenue / format=dollar15.2;
   define flight / width=6;
   define orig / width=spacing=5;
   define dest / width=4 spacing=5;
run;

Now the two columns display the extra spacing.

Example

Defining Column Headings

In addition to specifying column widths and spacing, you might want to change column headings. To define a column heading, specify the heading text in quotation marks in the DEFINE statement.

Example

Suppose you want to label Flight as Flight Number, Orig as Flight Origin and Dest as Flight Destination. Add these column headings to the DEFINE statements, being sure to match quotation marks. You can also change the WIDTH= specifications to accommodate the new headings.

proc report data=flights.europe nowd;
   where dest in ('LON','PAR'),
   column flight orig dest mail freight revenue;
   define revenue / format=dollar15.2;
   define flight / width=13 'Flight Number';
   define orig /  width=13  spacing=5 'Flight Origin';
   define dest /  width=18  spacing=5 'Flight Destination';
run;
Example

This is HTML output from the same program:

Example

Now you have the column headings that you want. But the columns are quite wide, aren't they? Let's see what you can do to fix this.

Defining the Split Character

To control how words break in column headings, you can use a split character in the column label. When PROC REPORT encounters the split character in a column heading, it breaks the heading and continues the heading on the next line. The split character itself does not appear in the heading.

To use a split character, you can do either of the following:

  • Use the default slash (/) as the split character.

  • Define a split character by using the SPLIT= option in the PROC REPORT statement.

Example

Suppose you want to break headings so that only one word appears on a line. Using the default slash as the split character, you can submit this PROC REPORT step. Notice that the column width has been reduced.

proc report data=flights.europe nowd;
   where dest in ('LON','PAR'),
   column flight orig dest mail freight revenue;
   define revenue / format=dollar15.2;
   define flight /  width=6 'Flight/Number';
   define orig /  width=6 spacing=5 'Flight/Origin';
   define dest /  width=11 spacing=5  'Flight/Destination';
run;

Or you can submit this program, which uses the SPLIT= option and produces exactly the same output:

proc report data=flights.europe nowd split='*';
   where dest in ('LON','PAR'),
   column flight orig dest mail freight revenue;
   define revenue / format=dollar15.2;
   define flight / width=6 'Flight*Number';
   define orig /  width=6 spacing=5  'Flight*Origin';
   define dest /  width=11 spacing=5  'Flight*Destination';
run;

Here are both types of output from both programs:

Example

Specifying Column Justification

You might also want to specify justification for columns in your report. Remember that by default, PROC REPORT left-justifies character variables and right-justifies numeric variables. For each variable that you define, you can specify the justification option CENTER, LEFT, or RIGHT in the DEFINE statement.

Each option justifies both the formatted values of the report item within the column width and the column headings over the values.

Example

To center headings and values for Flight, Orig, and Dest, you can specify the CENTER option as shown below in your DEFINE statements:

proc report data=flights.europe nowd;
   where dest in ('LON','PAR'),
   column flight orig dest mail freight revenue;
   define revenue / format=dollar15.2;
   define flight / width=6 'Flight/Number' center;
   define orig / width=6 spacing=5 'Flight/Origin' center;
   define dest / width=11 spacing=5 'Flight/Destination' center;
run;
Example

Enhancing the Heading's Appearance

To complete the job of enhancing headings in your list report, you can take advantage of two useful options in the PROC REPORT statement:

  • HEADLINE, which underlines all column headings and the spaces between them

  • HEADSKIP, which writes a blank line beneath all column headings or after the underline if the HEADLINE option is used.

These options have no effect on HTML output.

Example

In this PROC REPORT step, the PROC REPORT statement specifies both HEADLINE and HEADSKIP.

proc report data=flights.europe nowd headline headskip;
   where dest in ('LON','PAR'),
   column flight orig dest mail freight revenue;
   define revenue / format=dollar15.2;
   define flight / width=6 'Flight/Number' center;
   define orig / width=6 spacing=5 'Flight/Origin' center;
   define dest / width=11 spacing=5 'Flight/Destination' center;
run;

In the SAS listing output, the column headings are underlined and are followed by a blank line.

Example

Defining Variable Usage

So far, you've selected data for your list report and have defined column attributes and headings. Next, let's look at a more complex PROC REPORT feature: usage for variables in your report. You've seen that you define variable usage in the DEFINE statement. Now you can see how each usage affects the layout of your report and the values that the report contains.

How PROC REPORT Uses Variables

PROC REPORT uses each variable in one of six ways (DISPLAY, ORDER, GROUP, ACROSS, ANALYSIS, or COMPUTED). By default, PROC REPORT uses

  • character variables as display variables

  • numeric variables as analysis variables, which are used to calculate the SUM statistic.

Because you haven't explicitly defined any variable usages, your current list report contains only display and analysis variables:

  • The character variables Flight, Orig, and Dest are display variables. Display variables don't affect the order of rows in the report. A report that contains one or more display variables has a detail row for each observation that is read from the data set. Each detail row contains a value for each display variable.

  • The numeric variables Mail, Freight, and Revenue are analysis variables. Analysis variables are used to calculate a statistic (in this case, the default SUM).

In the illustration below, columns for display variables are shown in white. Columns for analysis variables are shown in gray.

How PROC REPORT Uses Variables

How you use a variable in a report determines, among other things, the order of the rows in your report. Let's see the effect of defining a variable as an order variable.

Using Order Variables

An order variable orders the detail rows in a report according to their formatted values. For example, suppose you want to see values in your list report ordered by flight number. To use Flight as an order variable, you specify the ORDER usage option in the DEFINE statement, as shown below.

proc report data=flights.europe nowd headline headskip;
   where dest in ('LON','PAR'),
   column flight orig dest mail freight revenue;
   define revenue / format=dollar15.2;
   define flight /  order 'Flight/Number' width=6 center;
   define orig / width=6 spacing=5 'Flight/Origin' center;
   define dest / width=11 spacing=5 'Flight/Destination'   center;
run;

This is your ordered output. Notice that PROC REPORT displays only the first occurrence of each value of an order variable in a set of rows that have the same value for all order variables.

Using Order Variables

By default, the order is ascending, but you can change it with the DESCENDING option in the DEFINE statement:

proc report data=flights.europe nowd headline headskip;
   where dest in ('LON','PAR'),
   column flight orig dest mail freight revenue;
   define revenue / format=dollar15.2;
   define flight / order  descending 'Flight/Number' width=6   center;
   define orig / width=6 spacing=5 'Flight/Origin' center;
   define dest / width=11 spacing=5 'Flight/Destination'   center;
run;

Using Group Variables

Your list report is complete. But suppose you now want to create a summary report. That is, rather than a list of the mail, freight, and revenue for each flight, you want the total mail, freight, and revenue by flight number. Here is the summary report that you want to create:

Using Group Variables

To summarize your data using PROC REPORT, you can define one or more group variables. A group variable groups the detail rows in a report according to their formatted values. If a report contains one or more group variables, PROC REPORT consolidates into one row all observations from the data set that have a unique combination of values for all group variables.

To define a group variable, you specify the GROUP usage option in the DEFINE statement. Let's see how group variables affect your report.

Example

If you submit the following PROC REPORT step, with Flight defined as a group variable, you get the output shown below.

proc report data=flights.europe nowd headline headskip;
   where dest in ('LON','PAR'),
   column flight orig dest mail freight revenue;
   define revenue / format=dollar15.2;
   define flight /  group 'Flight/Number' width=6 center;
   define orig / width=6 spacing=5 'Flight/Origin' center;
   define dest / width=11 spacing=5 'Flight/Destination' center;
run;
Example

But this output looks exactly like the list output in which Flight was an order variable. What happened?

The problem with the preceding output is that your report contains display variables. As character variables, Orig and Dest are defined as display variables by default.

All of the variables in a summary report must be defined as group, analysis, across, or computed variables. This is because PROC REPORT must be able to summarize all variables across an observation in order to collapse observations. If PROC REPORT can't create groups, it displays group variables as order variables.

Revising the Report

To group data in your report, you need to define the character variables (Flight, Orig, and Dest) as group variables, as shown below:

proc report data=flights.europe nowd headline headskip;
   where dest in ('LON','PAR'),
   column flight orig dest mail freight revenue;
   define revenue / format=dollar15.2;
   define flight /  group  'Flight/Number' width=6 center;
   define orig /  group  width=6 spacing=5 'Flight/Origin'
                center;
   define dest /  group width=11 spacing=5
                'Flight/Destination' center;
run;

Now PROC REPORT can create groups, and your summary report displays the total mail, freight, and revenue by flight number. Remember that the default statistic for the analysis variables is SUM.

Revising the Report

The following table compares the effects of using order variables and group variables.

 

ORDER

GROUP

Rows are ordered

yes

yes

Repetitious printing of values is suppressed

yes

yes

Rows that have the same values are collapsed

no

yes

Type of report produced

list

summary

Specifying Statistics

As you saw in the previous example and practice, the default statistic for analysis variables is SUM. But you might want to display other statistics in your PROC REPORT output. To associate a statistic with an analysis variable, specify it as an attribute in the DEFINE statement.

Here's the previous sample output, which displays the default statistic SUM for the three analysis variables:

Specifying Statistics

By specifying MEAN in the DEFINE statement for Revenue, you can display the average revenue for each flight number. The optional column heading Average Revenue clarifies that the MEAN statistic is displayed.

proc report data=flights.europe nowd headline headskip;
   where dest in ('LON','PAR'),
   column flight orig dest mail freight revenue;
   define revenue /  mean format=dollar15.2
                 'Average/Revenue';
   define flight / group 'Flight/Number' width=6 center;
   define orig / group width=6 spacing=5 'Flight/Origin'
                center;
   define dest / group width=11 spacing=5
               'Flight/Destination' center;
run;
Specifying Statistics

You can use the following statistics in PROC REPORT:

Statistic

Definition

CSS

Corrected sum of squares

USS

Uncorrected sum of squares

CV

Coefficient of variation

MAX

Maximum value

MEAN

Average

MODE

Value that occurs most frequently (new in SAS 9.2)

MIN

Minimum value

N

Number of observations with nonmissing values

NMISS

Number of observations with missing values

RANGE

Range

STD

Standard deviation

STDERR

Standard error of the mean

SUM

Sum

SUMWGT

Sum of the Weight variable values

PCTN

Percentage of a cell or row frequency to a total frequency

PCTSUM

Percentage of a cell or row sum to a total sum

VAR

Variance

T

Student's t for testing the hypothesis that the population mean is 0

PRT

Probability of a greater absolute value of Student's t

Using Across Variables

So far, we've looked at display, analysis, order, and group variables. You can also define variables as across variables, which are functionally similar to group variables. However, PROC REPORT displays the groups that it creates for an across variable horizontally rather than vertically.

Let's look at an example of across variables to clarify this usage.

Example

The following program uses group variables to produce the output shown. The table shows unique combinations of values of the group variables, and sums of each analysis variable for each combination.

proc report data=flights.europe nowd headline headskip;
   where dest in ('LON','PAR'),
   column flight dest mail freight revenue;
   define revenue / format=dollar15.2;
   define flight /  group 'Flight/Number' width=6 center;
   define dest /  group width=11 spacing=5
                 'Flight/Destination' center;
run;
Example

Now let's suppose that you change the group variables to across variables, as in this program.

proc report data=flights.europe nowd headline headskip;
   where dest in ('LON','PAR'),
   column flight dest mail freight revenue;
   define revenue / format=dollar15.2;
   define flight /  across 'Flight/Number' width=6 center;
   define dest /  across width=11 spacing=5
                'Flight/Destination' center;
run;

In this case, for each across variable, the table cells contain a frequency count for each unique value. For each analysis variable, the table cells represent the sum of all the variable's values.

Example

Using Computed Variables

The last type of variable usage is reserved for computed variables, which are numeric or character variables that you define for the report. They are not in the input data set, and PROC REPORT doesn't add them to the input data set. You can't change the usage of a computed variable.

In the nonwindowing environment, you add a computed variable as follows:

  1. Include the computed variable in the COLUMN statement.

  2. Define the variable's usage as COMPUTED in the DEFINE statement.

  3. Compute the value of the variable in a compute block that is associated with the variable.

Using Computed Variables

Let's see how you create a new variable for your report.

Example

Suppose you want to determine the number of empty seats for each flight. To do so, you can compute the variable EmptySeats by subtracting the number of passengers deplaning (Deplaned) from the plane's total number of seats (Capacity), assuming that the plane was full at the beginning of the flight.

In the following program, you

  • specify EmptySeats in the COLUMN statement to the right of the variables that are used in its calculation.

  • define EmptySeats as a computed variable in a DEFINE statement.

  • begin a compute block by specifying EmptySeats in a COMPUTE statement.

  • use DATA step statements in the compute block to calculate EmptySeats' value. Notice that when you refer to an analysis variable, you use a compound name that identifies both the original variable and the statistic that PROC REPORT now calculates from it. The compound name has the form variable-name.statistic.

  • close the compute block with an ENDCOMP statement.

  proc report data=flights.europe nowd;
    where dest in ('LON','PAR'),
    column flight capacity deplaned  emptyseats;
    define flight / width=6;
    define emptyseats / computed 'Empty Seats'; 
    compute emptyseats; 
        emptyseats=capacity.sum-deplaned.sum; 
    endcomp;
run;

The program creates the following output.

Example

Chapter Summary

Text Summary

Creating a Default List Report

To create a default list report, you submit a basic PROC REPORT step. You can specify options to invoke the procedure in either windowing or nonwindowing mode. By default, all observations and variables in the data set are printed, and variables appear in the order in which they occur in the data set.

Selecting Variables

To select and order the variables that appear in your list report, you can use the COLUMN statement.

Selecting Observations

To select rows for your report, you can use the WHERE statement as you do with many other SAS procedures.

Defining Variables

You can enhance your report by defining how each variable is used in the report. To describe how to use and display variables in your report, you use one or more DEFINE statements.

Defining Column Attributes

To assign a format to a specific report column, use the FORMAT= attribute in the DEFINE statement for that column. To specify a width for columns in your report, use the WIDTH= attribute in the DEFINE statement. To specify a different column spacing, use the SPACING= attribute in the DEFINE statement. To define a column heading, specify the heading text in quotation marks in the DEFINE statement. To control how words break in column headings, you can use a split character in the column label. For each variable that you define, you can specify the justification option CENTER, LEFT, or RIGHT in the DEFINE statement.

Enhancing the Heading's Appearance

To enhance headings in your report, you can use the HEADLINE option, which underlines all column headings and the spaces between them, and the HEADSKIP option, which writes a blank line before the data values. These options have no effect on HTML output.

Defining Variable Usage

PROC REPORT uses each variable in one of six ways (DISPLAY, ORDER, GROUP, ACROSS, ANALYSIS, or COMPUTED). By default, PROC REPORT uses character variables as display variables, and it uses numeric variables as analysis variables, which are used to calculate the SUM statistic. You can define usage for variables in the DEFINE statement.

Variable Usage in PROC REPORT

Display variables

do not affect the order of rows in the report. A report that contains one or more display variables has a detail row for each observation in the data set. Each detail row contains a value for each display variable. By default, PROC REPORT treats all character variables as display variables.

Order variables

order the detail rows in a report according to their formatted values.

Group variables

order the detail rows in a report according to their formatted values. If a report contains one or more group variables, PROC REPORT tries to consolidate into one row all observations from the data set that have a unique combination of values for all group variables.

Across variables

are functionally similar to group variables; however, PROC REPORT displays the groups that it creates for an across variable horizontally rather than vertically.

Analysis variables

are used to calculate a statistic. By default, PROC REPORT uses numeric variables as analysis variables, which are used to calculate the SUM statistic.

Computed variables

are variables that you define for the report. They are not in the data set. You cannot change the usage of a computed variable. Computed variables can be either numeric or character variables.

Specifying Statistics

To associate a statistic with an analysis variable, specify it as an attribute in the DEFINE statement.

Syntax

PROC REPORT < DATA=SAS-data-set> <options>;

         COLUMN variable(s);

         DEFINE variable /< usage> <attributes(s)><option(s)>

                  <justification> <'column-heading'>;

         COMPUTE computed-variable;

              DATA step statements;

         ENDCOMP;

RUN;

Sample Program

proc report data=clinic.diabetes nowd;
   column sex weight fastgluc postgluc glucrange;
   where age>40;
   define weight / format=comma6.2 spacing=4
                   'Average/Weight' width=7;
   define sex / order width=7 spacing=4 center
                'Sex of/Patient';
   define fastgluc / 'Fasting/Glucose';
   define postgluc / 'Postprandial/Glucose'
                     width=12;
   define glucrange / computed 'Glucose/Range';
   compute glucrange;
      glucrange=postgluc.sum-fastgluc.sum;
   endcomp;
run;

Points to Remember

  • You can use PROC REPORT in either windowing or nonwindowing mode.

  • You can use FORMAT statements with PROC REPORT, but the DEFINE statement enables you to specify more than one column attribute at a time.

  • For HTML output, the FORMAT= option cannot increase cell width beyond the width of cell values. The WIDTH= and SPACING= attributes, along with the HEADSKIP and HEADLINE options, have no effect on HTML output.

  • You can use the default slash as the split character, or you can specify a split character using the SPLIT= option in the PROC REPORT statement.

  • By default, PROC REPORT uses character variables as display variables and numeric variables as analysis variables, which are used to calculate the SUM statistic.

  • All of the variables in a summary report must be defined as group, analysis, across, or computed variables. If PROC REPORT can't create groups, it displays group variables as order variables.

  • You can't change the usage of a computed variable.

  • The position of a computed variable is important. You can't base the calculation of a computed variable on any variable that appears to its right in the report.

Chapter Quiz

Select the best answer for each question. After completing the quiz, check your answers using the answer key in the appendix.

  1. If Style has four unique values and you submit the following program, which output do you get? (Assume that all the other variables are numeric.)

    proc report data=sasuser.houses nowd;
       column style sqfeet bedrooms price;
       define style / group;
    run;
    1. Chapter Quiz
    2. Chapter Quiz
    3. Chapter Quiz
    4. Chapter Quiz
  2. When you define an order variable,

    1. the detail rows are ordered according to their formatted values.

    2. you can't create summary reports.

    3. PROC REPORT displays only the first occurrence of each order variable value in a set of rows that have the same value for all order variables.

    4. all of the above

  3. Which attributes or options are reflected in this PROC REPORT output?

    Chapter Quiz
    1. SKIPLINE and FORMAT=

    2. CENTER, HEADLINE, HEADSKIP, and either WIDTH=, SPACING=, or FORMAT=

    3. SPACING= only

    4. CENTER, FORMAT=, and HEADLINE

  4. To create a summary report that shows the average number of bedrooms and the maximum number of baths for each style of house, which DEFINE statements do you use in your PROC REPORT step?

    1. define style / center 'Style of/House';
      define bedrooms / mean 'Average/Bedrooms';
      define baths / max 'Maximum/Baths';
    2. define style / group;
      define bedrooms / mean 'Average/Bedrooms';
      define baths / max 'Maximum/Baths';
    3. define style / order;
      define bedrooms / mean 'Average/Bedrooms';
      define baths / max 'Maximum/Baths';
    4. define style / group;
      define bedrooms / 'Average/Bedrooms';
      define baths / 'Maximum/Baths'
  5. Which program does not contain an error?

    1. proc report data=sasuser.houses nowd;
         column style bedrooms baths;
         define style / order;
         define bedbathratio / computed format=4.2;
         compute bedbathratio;
            bedbathratio=baths.sum/bedrooms.sum; endcomp;
      run;
    2. proc report data=sasuser.houses nowd;
         column style bedrooms baths BedBathRatio;
         define style / order;
         define bedbathratio / order format=4.2;
         compute bedbathratio;
            bedbathratio=baths.sum/bedrooms.sum; endcomp;
      run;
    3. proc report data=sasuser.houses nowd;
         column style bedrooms baths BedBathRatio;
         define style / order;
         define bedbathratio / computed format=4.2;
         compute bedbathratio;
            bedbathratio=baths.sum/bedrooms.sum; endcomp;
      run;
    4. proc report data=sasuser.houses nowd;
         column style bedrooms baths BedBathRatio;
         define style / order;
         define bedbathratio / computed format=4.2;
         compute bedbathratio;
            bedbathratio=baths/bedrooms;
            endcomp;
      run;
  6. What output does this PROC REPORT step produce?

    proc report data=sasuser.houses nowd;
       column style sqfeet bedrooms price;
    run;
    1. a list report ordered by values of the first variable in the COLUMN statement

    2. a summary report ordered by values of the first variable in the COLUMN statement

    3. a list report that displays a row for each observation in the input data set and which calculates the SUM statistic for numeric variables

    4. a list report that calculates the N (frequency) statistic for character variables

  7. Which of the following programs produces this output?

    Chapter Quiz
    1. proc report data=sasuser.houses nowd;
         column style condo range split
                twostory price;
      
      
         define price / mean 'Average Price';
      run;
    2. proc report data=sasuser.houses nowd;
         column style price;
         define style / group;
         define price / mean 'Average Price';
      run;
    3. proc report data=sasuser.houses nowd;
         column style price;
         define style / across;
         define price / mean 'Average Price';
      run;
    4. proc report data=sasuser.houses nowd;
         column style price;
         define style / across 'CONDO' 'RANCH'
               'SPLIT' 'TWOSTORY';
         define price / mean 'Average Price';
      run;
  8. If you submit this program, where does your PROC REPORT output appear?

    proc report data=sasuser.houses nowd;
       column style sqfeet bedrooms price;
       define style / group;
    run;
    1. in the PROC REPORT window

    2. as HTML and/or SAS listing output

    3. both of the above

    4. neither of the above

  9. How can you create output with headings that break as shown below?

    Chapter Quiz
    1. You must specify the SPLIT= option in the PROC REPORT statement and use the split character in column headings in DEFINE statements.

    2. You must use the default split character in column headings in DEFINE statements.

    3. You must specify either the WIDTH= or the SPACING= attribute in DEFINE statements.

    4. These headings split this way by default.

  10. Suppose you want to create a report using both character and numeric variables. If you don't use any DEFINE statements in your PROC REPORT step,

    1. your PROC REPORT step will not execute successfully.

    2. you can produce only list reports.

    3. you can order rows by specifying options in the PROC REPORT statement.

    4. you can produce only summary reports.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset