Create a Generic Macro to Produce Tables

If you regularly produce tables with a similar design, you can create a generic macro to simplify the table production process. This enables you to set up a basic format for titles, footnotes, row variables, and column variables and then to use it in all of your tables.
  1. Create the code. To produce this generic macro, you start by creating the basic PROC TABULATE code. This is the part of the code that does not vary between your tables. Just leave placeholders for the parts that will change from table to table, which will be filled in later by macro variables.
    PROC TABULATE DATA=TEMP;
       CLASS avar1 bvar2;
       VAR cvar3;
       TABLE var1,
          var2 *var3 *(dstat)*F=efmt
          / ROW=FLOAT BOX="ftext1";
    TITLE "gtext2"; RUN; ...

Get PROC TABULATE by Example, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.