SAS OnlineTutor HomeFAQ PageSuggested Learning PathsContents+Searchback||next

Creating Tabular Reports
Formatting the Table


The final enhancement to make to your table is to specify the width of all table cells and the format for summary values in the table cells.

Look at the example below. Notice that the default format for table cells is 12.2. Two decimal places are displayed.


WalkJogRun Swim
Sum Sum
2009.00 1104.00


With many other procedures, you can use the FORMAT statement to assign SAS formats to values. But with PROC TABULATE, the FORMAT statement assigns only user-defined formats to class variable values, as in the table below. The FORMAT statement has no effect on the summary values in tables created by PROC TABULATE.


ActLevel
High Low Moderate
N N N
7 7 7


To specify a new format for all table cells, use the FORMAT= option in the PROC TABULATE statement.
     proc tabulate data=clinic.admit format=6.;
        class actlevel;
        var fee;
        table actlevel all,fee;
     run;

The FORMAT= option controls

  • the width of columns in the table
  • the format of values that appear in table cells.


Specifying Formats in the FORMAT= Option

In the FORMAT= option, you can specify any SAS or user-defined numeric format. Specifying FORMAT=6., for example, produces a table with cells formatted as shown below.

CAUTION: When you use the FORMAT= option, be sure to specify a format wide enough for the largest possible value or heading. (When specifying the cell width, don't count the vertical bars that outline the cell.)

     proc tabulate data=report.diabetes format=6.;

Type Referral
I II DR FM SF
N N N N N
3 17 10 5 5



back||next


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

Terms of Use & Legal Information | Privacy Statement