Lesson 10: The REPORT Procedure

Overview Section

A few lessons back, we learned how to use the PRINT procedure to create basic list reports of SAS data sets. In this lesson, we'll learn how to use the REPORT procedure to create not only basic list reports but also customized list reports, as well as a broad variety of summary reports. The customization that we will investigate includes assigning formats to some of the columns in the report, defining column headings, specifying the order of the contents of our reports, as well as specifying the justification, width, and spacing of the columns. We'll also learn how to group the character variables in our reports, so that we can create summary reports that contain statistical summaries of the columns, such as subtotals, grand totals, and averages.

You should know that the REPORT procedure is capable of creating highly customized reports. We'll necessarily focus only on the most common statements and the most common enhancements. For more extensive information about the REPORT procedure features, you might want to try Carpenter's Complete Guide to the SAS REPORT Procedure.

Example 10.1

Throughout this lesson, we'll work with a permanent SAS data set called stat480.penngolf that contains information on some Pennsylvania golf courses. The following SAS program merely tells SAS to print the stat480.penngolf data set:

OPTIONS PS = 58 LS = 80 NODATE NONUMBER;
            LIBNAME stat480 'C:\Yourdrivename\stat480wc\sasndata\';
            PROC PRINT data = stat480.penngolf;
               title 'Some Pennsylvania Golf Courses';
            RUN;

Some Pennsylvania Golf Courses

Obs

ID

Name

Architect

Year

Type

Par

Yards

Slope

USGA

1

101

Toftrees

Ed Ault

1968

Resort

72

7018

134

74.3

2

102

Penn State Blue

William Park, Jr.

1921

Public

72

6525

128

72.0

3

103

Centre Hills

Alex Findlay

1921

Private

71

6392

128

71.2

4

104

Lewistown CC

 

.

Private

72

6779

125

72.3

5

105

State College Elks

Lowell Erdman

1973

SemiPri

71

6369

123

70.9

6

106

Park Hills CC

James Harrison

1966

SemiPri

70

6004

126

69.3

7

107

Sinking Valley CC

Ad Ault

1967

SemiPri

72

6755

132

73.4

8

108

Williamsport CC

A.W Tillinghast

1909

Private

71

6489

131

71.9

9

109

Standing Stone CC

Geoffrey Cornish

1973

SemiPri

70

6593

120

71.4

10

110

Bucknell GC

 

1960

SemiPri

70

6253

132

70.0

11

111

Mount Airy Lodge

Hal Purdy

1972

Resort

72

7123

140

74.3

First, download the stat480.penngolf data set by clicking on the link. After you've saved the data set in a convenient location on your computer, launch the SAS program, and edit the LIBNAME statement so that it reflects the location in which you saved the stat480.penngolf data set. Finally, run  the SAS program, so that you have access to the data set throughout the lesson. Then, review the output from the PRINT procedure so that you can familiarize yourself with the data set.

Objectives

Upon completion of this lesson, you should be able to:

  • produce basic list and summary reports using the REPORT procedure
  • alter the purpose of a variable in reports produced by the REPORT procedure using DEFINE statements
  • change the format, width, and spacing of columns in reports produced by the REPORT procedure
  • specify the justification of the columns in reports produced by the REPORT procedure
  • change the column headers of variables appearing in a DEFINE statement
  • distinguish between the various usage options (display, order, group, across, analysis, and computed) of variables appearing in a DEFINE statement
  • create summary reports using the REPORT procedure
  • request that various statistics be included in your reports produced by the REPORT procedure