O'Reilly logo

PROC TABULATE by Example, Second Edition by Lauren Haworth Lake, Julie McKnight

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required