Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
The COMPUTAB Procedure

Controlling Execution within Row and Column Blocks

Row names, column names, and the special variables _ROW_ and _COL_ can be used to limit the execution of programming statements to selected rows or columns. A row block operates on all columns of the table for a specified row unless restricted in some way. Likewise, a column block operates on all rows for a specified column. Use column names or _COL_ in a row block to execute programming statements conditionally; use row names or _ROW_ in a column block.

For example, consider a simple column block consisting of only one statement:

   col: total = qtr1 + qtr2 + qtr3 + qtr4;

This column block assigns a value to each row in the TOTAL column. As each row participates in the execution of a column block,

To avoid calculating TOTAL on particular rows, use row names or _ROW_, for example,

   col: if sales|cost then total = qtr1 + qtr2 + qtr3 + qtr4;
or

   col: if _row_ < 3  then total = qtr1 + qtr2 + qtr3 + qtr4;

Row and column blocks can appear in any order, and rows and columns can be selected in each block.

Chapter Contents
Chapter Contents
Previous
Previous
Next
Next
Top
Top

Copyright © 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.