Using SAS "PROC TABULATE" for Clinical Trial Tables and listings
Posted by Keith Ward on Tue, Oct 26, 2010 @ 01:34 PM

Tables created for clinical studies have certain common features. A sample annotated demographics table (above) with annotated descriptions of the key features.
Notes for the table:
- This is not a simple page counter. It also includes the total number of pages for the given piece of output.
- In the column heading you see “N=,” which represents the number of subjects in the given column population.
- Here you have the p-values from inferential statistical comparisons.
- Note that the continuous statistics are presented with a row-based orientation.
- Categorical frequency counts are presented in a single item as “count (percentage).”These percentages can be calculated and formatted in many different ways, but they are always clustered together as a single column item.
- The footnote contains the name of the program that created the output as well as the date it was created.
You can use PROC TABULATE to produce a summary statistics matrix with very little effort. Here are the annotated demographics summary program, the annotated output and notes for the program, and a follow-up discussion of PROC TABULATE’s capabilities.
**** DEFINE OPTIONS FOR ASCII TEXT OUTPUT; #1
options nodate ls = 80 ps = 38 formchar = "|----|+|---+=|-/\<>*";
**** CREATE SUMMARY OF DEMOGRAPHICS WITH PROC TABULATE;
proc tabulate
data = demog
missing;
class trt gender race;
var age;
table age = 'Age' *
(n = 'n' * f = 8.
mean = 'Mean' * f = 5.1
std = 'Standard Deviation' * f = 5.1
min = 'Min' * f = 3. Max = 'Max' * f = 3.)
gender = 'Gender' *
(n='n' * f = 3. colpctn = '%' * f = 4.1)
race = 'Race' *
(n = 'n' * f = 3. colpctn = '%' * f = 4.1),
(trt = " ") (all = 'Overall');
format trt trt. race race. gender gender.;
title1 'Table 5.1';
title2 'Demographics and Baseline Characteristics';
footnote1 "* Other includes Asian, Native American, and other"
" races.";
footnote2 "Created by %sysfunc(getoption(sysin)) on"
" &sysdate9..";
run;
The above code produces the following output:

- The FORMCHAR option is specified to get the simple ASCII text results to appear in a platform independent way. We discuss output formatting later in this chapter.
- Note that SAS provides a page counter, but not the “Page X of N” style page counter.
- There are several items about the body of the table to mention here. First, there is no“p-value” column, as PROC TABULATE generally produces only descriptive statistics. Second, the styles of the “n (%)” statistics are oriented with “n” and “%”in different rows when we wanted “n (%)” in the same row in the same “cell.” Third, the field spanner for “Gender” is not indented differently from the summary statistic labels. Finally, note the missing (“.”) row category for gender. In the PROC TABULATE statement, if the MISSING option had been excluded, then the data for subject 712 would have been wrongly omitted from the output for all summarized variables, including age, gender, and race.
- In traditional ASCII text output, PROC TABULATE does provide a “continued” flag when the output spans multiple pages. (This is not the case with some ODS destinations, such as ODS RTF, where there is no “continued” flag.)
PROC TABULATE is an excellent tool for producing quick descriptive statistics on data, but it does not meet the typical needs of generating clinical trial tables, for several reasons:
1. It does not provide p-values beyond a simple t-test.
2. It does not present “n (%)” in a desired format.
3. Variable labels are not clearly differentiated from the summary statistics labels.
4. “Page X of N” pagination is not available.
5. Missing values are handled in an “all or nothing” way, so if you exclude missing
values for one variable, you end up excluding all data for that record for the other variables in the summary.
6. It does not place population counts in the column heading.