The COMPUTAB Procedure |
Adding Computed Rows and Columns |
In addition to the variables and observations in the input data set, you can create additional rows or columns by using SAS programming statements in PROC COMPUTAB. You can do the following:
modify input data and select columns in the input block
create or modify columns in column blocks
create or modify rows in row blocks
The following statements add one computed row (SUM) and one computed column (TOTAL) to the report in Figure 9.5. In the input block the logical operators indicate the observations that correspond to each column of the report. After the input block reads in the values from the input data set, the column block creates the column variable TOTAL by summing the columns A, B, and C. The additional row variable, SUM, is calculated as the sum of the other rows. The result is shown in Figure 9.6.
proc computab data= report; rows travel advrtise salary insure sum; columns a b c total; a = compdiv = 'A'; b = compdiv = 'B'; c = compdiv = 'C'; colblk: total = a + b + c; rowblk: sum = travel + advrtise + salary + insure; run;
Copyright © SAS Institute, Inc. All Rights Reserved.