ROWS and COLUMNS statements define the rows and columns of the report. The order of row and column names in these statements determines the order of rows and columns in the report. Additional ROWS and COLUMNS statements can be used to specify row and column formatting options.
The following statements select and order the variables from the input data set and produce the report in Figure 10.4:
proc computab data=report; rows travel advrtise salary; run;
Figure 10.4: Report Produced Using a ROWS Statement
When a COLUMNS statement is not specified, each observation becomes a new column. If you use a COLUMNS statement, you must specify to which column each observation belongs by using program statements for column selection. When more than one observation is selected for the same column, values are summed.
The following statements produce Figure 10.5:
proc computab data= report; rows travel advrtise salary insure; columns a b c; *----select column for company division, based on value of compdiv----*; a = compdiv = 'A'; b = compdiv = 'B'; c = compdiv = 'C'; run;
The statement A=COMPDIV=’A’; illustrates the use of logical operators as a selection technique. If COMPDIV=’A’, then the current observation is added to the A column. See SAS Language: Reference, Version 6, First Edition for more information about logical operators.
Figure 10.5: Report Produced Using ROWS and COLUMNS Statements