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.
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:\simon\stat480wc\fa08\10report\sasndata\'; PROC PRINT data = stat480.penngolf; title 'Some Pennsylvania Golf Courses'; RUN;
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.
Upon completing this lesson, you should be able to do the following:
- produce basic list and summary reports using the REPORT procedure
- use DEFINE statements to alter the purpose of a variable in reports produced by the REPORT procedure
- 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