BookmarkSubscribeRSS Feed
KoenN
Calcite | Level 5

I've read http://www.planta.cn/forum/files_planta/sas_programming_in_the_pharmaceutical_industry_119.pdf where it states on page 132 that :

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:

[...]

2. It does not present “n (%)” in a desired format.

I want to build a table that is very much like the table on page 127:

table1.JPG

The strategy that the authors use ('DATA step programming, SAS macro variables, some statistical procedures, and a final PROC REPORT for table presentation.'), described from page 138 onwards is too cumbersome for the project I'm working on.

My question: is it (still?) correct that PROC TABULATE can't plot the number of observations in a certain class followed by the percentage on the same row? Thank you so much!

3 REPLIES 3
ballardw
Super User

The issue with Tabulate is not that it "does not present "n (%)" in a desired format" but that it doesn't do it when combined with the elements shown above it in the table that were only counts.

Use 2 separate table statements, one for the parts without the % and separate with the percent. To display the % as ( 73.4%) you will need a custom format for the parentheses. There will be some space between the tables but with appropriate output style and options you can get something that looks much like what you need.

With tabulate you need to be very aware of the treatment when missing values for any of your class variables as well.

With ODS overrides you can set the column widths for the class variables so that things will line up. There are other things to control appearance depending upon desired output destination.

It would have been much better to copy the table example and paste it though as not everyone is going to want to take time to download a 7MB file from a somewhat slow server (at least when I looked).

KoenN
Calcite | Level 5

Thank you. You're absolutely right, I've added a screenshot of the table.

Cynthia_sas
SAS Super FREQ

Hi,

  The short answer to your question is that generally, people generate this type of demographic report using PROC REPORT or using a DATA step program. Proc TABULATE will not "merge" cells the way you want for 2 separate statistics (a count and a percent). Both of these approaches are outlined in my paper called Creating Complex Reports, where I have 3 examples of this type of demographic report. To find a link to the paper and the download of programs, go to this site Technical Papers and Presentations made by SAS staff and look for the 2008 presentations. You will need to search for the paper title "Creating Complex Reports" to find the links.

cynthia

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

How to Concatenate Values

Learn how use the CAT functions in SAS to join values from multiple variables into a single value.

Find more tutorials on the SAS Users YouTube channel.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 2529 views
  • 0 likes
  • 3 in conversation