Creating Enhanced List and Summary Reports |
Defining Variable Usage |
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: |
Flight Number |
Flight Origin |
Flight Destination |
Freight | Revenue | |
219 | LGA | LON | 2700 | 2513 | $1,111,647.00 |
271 | LGA | PAR | 5050 | 4421 | $1,969,201.00 |
821 | LGA | LON | 4438 | 4284 | $2,077,907.00 |
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.
If you submit the following PROC REPORT step, with |
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; |
Flight Number |
Flight Origin |
Flight Destination |
Freight | Revenue | |
219 |
|
|
331 | 376 | $189,065.00 |
|
|
485 | 267 | $197,456.00 | |
|
|
388 | 298 | $162,343.00 | |
|
|
421 | 356 | $134,520.00 | |
|
|
447 | 299 | $106,753.00 | |
|
|
356 | 547 | $122,766.00 | |
|
|
272 | 370 | $198,744.00 | |
271 |
|
|
492 | 308 | $156,804.00 |
|
|
366 | 498 | $190,098.00 | |
|
|
353 | 205 | $166,470.00 | |
|
|
366 | 279 | $163,248.00 | |
|
|
357 | 282 | $170,766.00 | |
|
|
415 | 463 | $195,468.00 | |
|
|
352 | 351 | $123,456.00 | |
|
|
492 | 308 | $125,632.00 | |
|
|
366 | 498 | $128,972.00 | |
|
|
353 | 205 | $153,423.00 | |
|
|
366 | 279 | $133,345.00 | |
|
|
357 | 282 | $126,543.00 | |
|
|
415 | 463 | $134,976.00 | |
821 |
|
|
403 | 209 | $150,634.00 |
|
|
345 | 243 | $150,634.00 | |
|
|
248 | 307 | $193,930.00 | |
|
|
391 | 395 | $167,772.00 | |
|
|
219 | 368 | $183,106.00 | |
|
|
389 | 479 | $169,576.00 | |
|
|
448 | 282 | $143,561.00 | |
|
|
403 | 209 | $170,766.00 | |
|
|
345 | 243 | $129,560.00 | |
|
|
248 | 307 | $196,736.00 | |
|
|
391 | 395 | $125,344.00 | |
|
|
219 | 368 | $166,543.00 | |
|
|
389 | 479 | $129,745.00 |
But this output looks exactly like the list output in which |
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.