Programming Statements

You can use most SAS programming statements the same way you use them in the DATA step. Also, all DATA step functions can be used in the COMPUTAB procedure.

Lines written by the PUT statement are not integrated with the COMPUTAB report. PUT statement output is written to the SAS log.

The automatic variable _N_ can be used; its value is the number of observations read or the number read in the current BY group, if a BY statement is used. FIRST.variable and LAST.variable references cannot be used.

The following statements are also available in PROC COMPUTAB:

    ABORT                    FORMAT
    ARRAY                    GOTO
    ATTRIB                   IF-THEN/ELSE
    assignment statement     LABEL
    CALL                     LINK
    DELETE                   PUT
    DO                       RETAIN
    iterative DO             SELECT
    DO UNTIL                 STOP
    DO WHILE                 sum statement
    END                      TITLE
    FOOTNOTE

The programming statements can be assigned labels ROWxxxxx: or COLxxxxx: to indicate the start of a row and column block, respectively. Statements in a row block create or change values in all the columns in the specified rows. Similarly, statements in a column block create or change values in all the rows in the specified columns.

There is an implied RETURN statement before each new row or column block. Thus, the flow of execution does not leave the current row (column) block before the block repeats for all columns (rows.) Row and column variables and nonretained variables are initialized prior to each execution of the block.

The next COLxxxxx: label, ROWxxxxx: label, or the end of the PROC COMPUTAB step signals the end of a row (column) block. Column blocks and row blocks can be mixed in any order. In some cases, performing calculations in different orders can lead to different results.

See the sections Program Flow Example, Order of Calculations, and Controlling Execution within Row and Column Blocks for more information.