Creating Enhanced List and Summary Reports |
Defining Variable Usage |
Using Computed Variables The last type of variable usage is reserved for computed variables, which are numeric or character variables that you define for the report. They are not in the input data set, and PROC REPORT doesn't add them to the input data set. You can't change the usage of a computed variable. In the nonwindowing environment, you add a computed variable as follows:
|
The position of a computed variable is important. PROC REPORT assigns values to the columns in a row of a report from left to right. Consequently, you can't base the calculation of a computed variable on any variable that appears to its right in the report. |
Let's see how you create a new variable for your report.
Suppose you want to determine the number of empty seats for each flight.
To do so, you can compute the variable In the following program, you
|
proc report data=flights.europe nowd; where dest in ('LON','PAR'); column flight capacity deplaned emptyseats; define flight / width=6; define emptyseats / computed 'Empty Seats'; compute emptyseats; emptyseats=capacity.sum-deplaned.sum; endcomp; run; |
The program creates the following output. |
Flight | Capacity | Deplaned | Empty Seats |
821 | 250 | 222 | 28 |
271 | 250 | 163 | 87 |
271 | 250 | 227 | 23 |
821 | 250 | 222 | 28 |
821 | 250 | 158 | 92 |
Copyright © 2002 SAS Institute Inc.,
Cary, NC, USA. All rights reserved.