List specific information about selected observations in a data set in a specific order. Group the rows by the values of the ordering variables. Each row in the report should present information for one observation.
Listing of Local Residential Properties Price Range $200,000 to $350,000 Listed by Zone Residential Listing House Square Zone Price Style Address Bedrooms Bathrooms Feet Age ---------------------------------------------- ---------------------------------------------- East Lake $329,900 ranch 8122 Maude Steward Rd. 3 3.0 2,400 2 $281,900 split 6424 Old Jenks Rd. 3 1.5 1,225 18 $260,000 split 4341 Rock Quarry 3 1.0 1,010 28 $207,900 ranch 6509 Orchard Knoll 3 2.0 1,526 6 Ensley $260,000 townhouse 409 Galashiels 2 1.5 1,280 4 Inside Beltline $343,000 capecod 100 Cumberland Green 3 2.5 1,650 0 $284,000 townhouse 765 Crabtree Crossing 3 2.0 1,471 1 $279,950 split 101 Meadowglade Ln. 3 2.0 2,004 0 $279,900 townhouse 108 Chattle Close 3 2.5 2,080 4 $259,900 townhouse 216 Concannon Ct. 2 1.5 1,040 9 $249,900 townhouse 1239 Donaldson Ct. 2 1.5 1,150 15 Mountain Brook $200,000 duplex 108 South Elm St. 3 1.0 1,569 73 North Ridge $344,500 bungalow 6008 Brass Lantern Ct. 3 2.5 2,416 6 $314,900 colonial 4000 Skipjack Ct. 3 2.5 2,750 0 $285,000 split 2414 Van Dyke 3 1.0 1,245 36 $282,900 split 500 E. Millbrook Rd. 3 1.5 1,329 23 $200,000 split 6324 Lakeland, Lake Park 3 2.0 1,662 12 Roebuck $323,500 split 110 Skylark Way 3 2.0 1,976 10 $286,900 split 5617 Laurel Crest Dr. 3 1.5 1,441 28 $271,000 townhouse 8 Stonevillage 2 2.0 1,276 6 Southside $202,000 townhouse 154 Montrose 2 2.0 1,595 6 Westend $278,900 split Rt.5 Yarbororugh Rd. 2 1.0 960 2 $217,800 split 603 Greentree Dr. 3 2.0 1,533 5 Listing Produced on Dec 10, 2005 |
Data Set | HOUSING |
Featured Step | PROC REPORT |
Featured Step Statements and Options | DEFINE statement: ORDER option
WHERE statement BREAK AFTER statement |
Formatting Features | PROC REPORT statement: SPLIT= option PROC REPORT statement: HEADLINE, SPACING=, and WIDTH= options when sending output to the LISTING destination |
Additional Features | Macro functions |
Related Technique | PROC SORT and PROC PRINT |
A Closer Look | Comparing PROC PRINT and PROC REPORT |
ODS Enhanced Version of this Example | Example 6.1 |
Other Examples That Use This Data Set | Examples 2.1 and 6.1 |
This detail report lists specific data about houses for sale within the price range of $200,000 to $350,000 and is similar to Example 2.1. This report, however, does not require that you sort the data set prior to producing the report. Statements within PROC REPORT order the rows first by residential zone and then within each residential zone, by descending price.
Each row in the report corresponds to one observation in the HOUSING data set. Each column corresponds to one variable.
A report similar to the one featured above can be produced with PROC SORT and PROC PRINT as demonstrated in this section. Figure 2.2 presents the output from a program that uses PROC SORT and PROC PRINT.
Listing of Local Residential Properties Price Range $200,000 to $350,000 Listed by Zone House Square Listing Zone Style Address Bedrooms Bathrooms Feet Age Price North Ridge bungalow 6008 Brass Lantern Ct. 3 2.5 2,416 6 $344,500 colonial 4000 Skipjack Ct. 3 2.5 2,750 0 $314,900 split 500 E. Millbrook Rd. 3 1.5 1,329 23 $282,900 split 2414 Van Dyke 3 1.0 1,245 36 $285,000 split 6324 Lakeland, Lake Park 3 2.0 1,662 12 $200,000 Inside Beltline capecod 100 Cumberland Green 3 2.5 1,650 0 $343,000 split 101 Meadowglade Ln. 3 2.0 2,004 0 $279,950 townhouse 1239 Donaldson Ct. 2 1.5 1,150 15 $249,900 townhouse 216 Concannon Ct. 2 1.5 1,040 9 $259,900 townhouse 765 Crabtree Crossing 3 2.0 1,471 1 $284,000 townhouse 108 Chattle Close 3 2.5 2,080 4 $279,900 Southside townhouse 154 Montrose 2 2.0 1,595 6 $202,000 East Lake ranch 6509 Orchard Knoll 3 2.0 1,526 6 $207,900 ranch 8122 Maude Steward Rd. 3 3.0 2,400 2 $329,900 split 4341 Rock Quarry 3 1.0 1,010 28 $260,000 split 6424 Old Jenks Rd. 3 1.5 1,225 18 $281,900 Westend split Rt.5 Yarbororugh Rd. 2 1.0 960 2 $278,900 split 603 Greentree Dr. 3 2.0 1,533 5 $217,800 Mountain Brook duplex 108 South Elm St. 3 1.0 1,569 73 $200,000 Ensley townhouse 409 Galashiels 2 1.5 1,280 4 $260,000 Roebuck split 5617 Laurel Crest Dr. 3 1.5 1,441 28 $286,900 split 110 Skylark Way 3 2.0 1,976 10 $323,500 townhouse 8 Stonevillage 2 2.0 1,276 6 $271,000 Listing Produced on Dec 10, 2005 |
The program that produced the report in Figure 2.2 follows.
Ensure that the BYLINE option is in effect when executing this program. This will keep information for multiple zones on the same page. If NOBYLINE is in effect, PROC PRINT starts a new page for each value of the BY variable, ZONE. For more about the BYLINE option, see Example 2.3.
If you want to send the report to the LISTING destination, you can achieve the look of underlining in the headings. Revise the LABEL statement as follows to include the split character followed by dashes.
label zone='Zone/---------------' type='House/Style/--------' address='Address/-------------------------' bedr='Bedrooms/--------' bath='Bathrooms/---------' sqfeet='Square/Feet/------' age='Age/---' price='Listing/Price/----------';
The revised LABEL statement causes the headings to appear as if they are underlined, as shown below in the following partial listing of the report.
Listing of Local Residential Properties Price Range $200 ,000 to $350,000 Listed by Zone House Square Listing Zone Style Address Bedrooms Bathrooms Feet Age Price --------------- -------- ------------------------- -------- --------- ------ --- ---------- North Ridge bungalow 6008 Brass Lantern Ct. 3 2.5 2,416 6 $344,500 colonial 4000 Skipjack Ct. 3 2.5 2,750 0 $314,900 split 2414 Van Dyke 3 1.0 1,245 36 $285,000 split 500 E. Millbrook Rd. 3 1.5 1,329 23 $282,900 split 6324 Lakeland, Lake Park 3 2.0 1,662 12 $200,000 |
A Closer Look |
The two reports in this example are similar. The processing of the two procedures REPORT and PRINT can differ. The differences are highlighted in Table 2.2.
BY statement processing. See “BY Statement” in the “Statements” section of SAS 9.1 Language Reference: Dictionary, and “Statements with the Same Function in Multiple Procedures” in the “Concepts” section of Base SAS 9.1 Procedures Guide.
PROC PRINT reference, usage information, and additional examples. See “The PRINT Procedure” in the “Procedures” section of Base SAS 9.1 Procedures Guide.
PROC REPORT reference, usage information, and additional examples. See “The REPORT Procedure” in the “Procedures” section of Base SAS 9.1 Procedures Guide.
3.15.151.21