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]

From |
Nick Cox <njcoxstata@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: RE: percentage format |

Date |
Thu, 10 Feb 2011 10:15:41 +0000 |

One view on this, whether or not it is the StataCorp view, is that 1. it is easy enough to specify in a variable label that results are "%", "percent", "percentage", "Pct", etc. and through that users have complete control over what is shown. 2. it is easy enough to use a -display- statement to show something similar for individual summary measures. 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. Nick On Thu, Feb 10, 2011 at 9:23 AM, Harry Comber <h.comber@ncri.ie> wrote: > Thanks for the information. My apologies for an error in the original > question, where I should have written "mean" and not "sum", as pointed > out by Caleb, and as I realised after I posted the question. As I said, > I knew there were workarounds, but it would be more convenient not to > have to create more variables and also have to add in "%" signs later. > If there is no such format, I'll work out something else. Nick Cox > I was thinking that you wanted an explicit "%" sign. Perhaps so, perhaps > not. If you don't, then as Caleb advised it is often easy enough. Nick Cox > There is no such format that I know of. I can't think of a reason for > not documenting it as others would want it too for your reasons. > > In some circumstances you can mimic this by creating a string variable > such as below: > > . sysuse auto > > . su weight > > Variable | Obs Mean Std. Dev. Min Max > -------------+-------------------------------------------------------- > weight | 74 3019.459 777.1936 1760 4840 > > . gen sweight = string(100 * weight/r(mean), "%8.2f") + "%" > > . l sweight in 1/10 > > +---------+ > | sweight | > |---------| > 1. | 97.04% | > 2. | 110.95% | > 3. | 87.43% | > 4. | 107.64% | > 5. | 135.12% | > |---------| > 6. | 121.54% | > 7. | 73.85% | > 8. | 108.63% | > 9. | 128.50% | > 10. | 112.60% | > +---------+ > > I am not clear that this helps you with -table-. Some tables are easier > to mimic than others. Two- and higher-dimensional tables are naturally > more difficult. > > Nick > n.j.cox@durham.ac.uk > > Harry Comber > > Is there an extension of the Stata -format- command which produces > percentage formats? I would like to use this in the -table- command as > in (hypothetically): > table sex agegroup, c(sum surgery) format(%2.1p) > If "surgery" is either 0 (no) or 1 (yes) for each individual, this would > give a table of % having surgery. I know there are other ways of doing > this but the tables are typically much more complex than the example > given and it would be very useful to me if I could format the output as > percentages. * * 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/

**Follow-Ups**:**Re: st: RE: percentage format***From:*Ronan Conroy <rconroy@rcsi.ie>

**References**:**st: tab varname without the varname label***From:*José Maria Pacheco de Souza <jmpsouza@usp.br>

**st: RE: tab varname without the varname label***From:*Nick Cox <n.j.cox@durham.ac.uk>

**st: RE: RE: tab varname without the varname label***From:*Nick Cox <n.j.cox@durham.ac.uk>

**st: percentage format***From:*"Harry Comber" <h.comber@ncri.ie>

**st: RE: percentage format***From:*Nick Cox <n.j.cox@durham.ac.uk>

**st: RE: RE: percentage format***From:*Nick Cox <n.j.cox@durham.ac.uk>

**st: RE: percentage format***From:*"Harry Comber" <h.comber@ncri.ie>

- Prev by Date:
**Re: st: goodness of fit svy: probit** - Next by Date:
**st: date/time question** - Previous by thread:
**st: RE: percentage format** - Next by thread:
**Re: st: RE: percentage format** - Index(es):