Previous Page | Next Page

The COMPUTAB Procedure

Producing a Simple Report

Without any specifications, the COMPUTAB procedure transposes and prints the input data set. The variables in the input data set become rows in the report, and the observations in the input data set become columns. The variable names are used as the row titles. The column headings default to COL1 through COLn. For example, the following input data set contains the monthly expenses reported by different divisions of the company:

   data report;
      length compdiv $ 1;
      input compdiv $ date:date7. salary travel insure advrtise;
      format date date7.;
      label travel   = 'Travel Expenses within U.S.'
            advrtise = 'Advertising'
            salary   = 'Permanent Staff Salaries'
            insure   = 'Benefits Including Insurance';
   datalines;
   A 31JAN1989 95000  10500  2000 6500
   B 31JAN1989 668000 112000 5600 90000
   C 31JAN1989 105000 6800   9000 18500
   A 28FEB1989 91000  8200   1900 12000
   B 28FEB1989 602000 99000  5500 86000
   C 28FEB1989 96000  6000   8500 16000
   ;

You can get a listing of the data set by using the PRINT procedure, as follows:

   title 'Listing of Monthly Divisional Expense Data';
   proc print data=report;
   run;

Figure 9.2 Listing of Data Set by PROC PRINT
Listing of Monthly Divisional Expense Data

Obs compdiv date salary travel insure advrtise
1 A 31JAN89 95000 10500 2000 6500
2 B 31JAN89 668000 112000 5600 90000
3 C 31JAN89 105000 6800 9000 18500
4 A 28FEB89 91000 8200 1900 12000
5 B 28FEB89 602000 99000 5500 86000
6 C 28FEB89 96000 6000 8500 16000

To get a simple, transposed report of the same data set, use the following PROC COMPUTAB statement:

   title 'Monthly Divisional Expense Report';
   proc computab data=report;
   run;

Figure 9.3 Listing of Data Set by PROC COMPUTAB
Monthly Divisional Expense Report

                 COL1       COL2       COL3       COL4       COL5       COL6    
                                                                                
  compdiv           A          B          C          A          B          C    
  date        31JAN89    31JAN89    31JAN89    28FEB89    28FEB89    28FEB89    
  salary     95000.00  668000.00  105000.00   91000.00  602000.00   96000.00    
  travel     10500.00  112000.00    6800.00    8200.00   99000.00    6000.00    
  insure      2000.00    5600.00    9000.00    1900.00    5500.00    8500.00    
  advrtise    6500.00   90000.00   18500.00   12000.00   86000.00   16000.00    

Previous Page | Next Page | Top of Page