Creating Enhanced List and Summary Reports |
Defining Variable Usage |
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 |
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' |
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. |
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 |
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; |
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.