12-09-2014 11:27 AM
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:
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!
12-09-2014 11:44 AM
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).
12-09-2014 01:18 PM
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.