Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: st: RE: percentage format


From   Eric Booth <ebooth@ppri.tamu.edu>
To   "<statalist@hsphsun2.harvard.edu>" <statalist@hsphsun2.harvard.edu>
Subject   Re: st: RE: percentage format
Date   Thu, 10 Feb 2011 14:50:20 +0000

<>

Harry:

Another option is to take a look at -tabout- (from SSC).  It has an option to add these percentage signs, so in creating a table similar to your code:

> table sex agegroup, c(sum surgery) format(%2.1p)

in tabout you could:

**********!
//install tabout//
cap which tabout
if _rc ssc install tabout, replace

*****

//create some data//
sysuse bplong, clear
g sugery = rbinomial(1, .4)
lab def s 0 No 1 Yes
lab val sugery s

// 1.   tabout summary table//
preserve 
replace sugery = 100*sugery
tabout sex agegrp using "test.xls", ///
	replace sum c(mean sugery count sugery)  ///
	f(1p 2c) h2(% Patients that had Surgery)  ///
	ptotal(both)
restore


//2.     standard tabout table//
tabout sugery sex using "test.xls", ///
	append c(freq col)  ///
	f(2c 1p) h1(% Patients that had Surgery, by Sex) ///
	ptotal(both)
	
tabout sugery agegrp using "test.xls", ///
	append c(freq col)  ///
	f(2c 1p) h1(% Patients that had Surgery, by Age Group)  ///
	ptotal(both)

// take a look....
di as smcl `"open {browse `"test.xls"'} or {stata `" view test.xls"'}"'
**********!

- Eric
__
Eric A. Booth
Public Policy Research Institute
Texas A&M University
ebooth@ppri.tamu.edu


On Feb 10, 2011, at 6:51 AM, Ronan Conroy wrote:

> On 10 Feb 2011, at 10:15, Nick Cox wrote:
> 
>> 3. "%" being displayed against every value in a row, column or table
>> is busy, repetitive and a minor insult to the reader.
> 
>> I guess there is room for disagreement, especially on #3.
> 
> In tables where cell contents may be frequencies or percentages, then the "%" is invaluable. (The output of Stata's own -tabulate- for instance). I, for one, would welcome some way of getting percentage signs in Stata output.
> 
> I use Pages, the iWork word processor, which allows you to make a table from Stata output and then format the decimal numbers as percentages. Obviously only works on a Mac, but a real time saving trick if you have one.
> 
> 
> Ronán Conroy
> rconroy@rcsi.ie
> Associate Professor
> Division of Population Health Sciences
> Royal College of Surgeons in Ireland
> Beaux Lane House
> Dublin 2
> 
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/help.cgi?search
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/



*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index