[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

From |
David Kantor <dkantor@jhu.edu> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: computing percentages |

Date |
Wed, 28 Apr 2004 11:29:56 -0400 |

At 09:36 AM 4/28/2004 -0500, Mike Merten wrote:

I am using the following command:As Nick pointed out, you probably want to aggregate over the dataset or parts thereof, counting up and dividing (count of nonmetro) / (count of total) .

g nonmetro=hmsa_r==2

g total=hmsa_r==1 | hmsa_r==2 | hmsa_r==3

gen pnonmetro=nonmetro/total

I want the "pnonmetro" variable to be expressed in terms of percentage, from the resulting nonmetro/total. How do I do this?

Thanks,

[...]

But note that pnonmetro is valued either 0, 1, or missing. If you take its mean (-sum pnonmetro-), I believe the result will be the same as the quotient of counts as above.

(I've left off the factor of 100 -- a cosmetic change.)

I hope this helps.

-- David

David Kantor

Institute for Policy Studies

Johns Hopkins University

dkantor@jhu.edu

410-516-5404

*

* For searches and help try:

* http://www.stata.com/support/faqs/res/findit.html

* http://www.stata.com/support/statalist/faq

* http://www.ats.ucla.edu/stat/stata/

**Follow-Ups**:**st: Confidence bands for smoothed hazard funtions***From:*"Anthony Gichangi" <anthony@stat.sdu.dk>

**References**:**st: computing percentages***From:*"mertenmj" <mertenmj@mail.isunet.net>

- Prev by Date:
**st: RE: RE: computing percentages** - Next by Date:
**st: RE: RE: creating age at first birth from birth historydata** - Previous by thread:
**st: computing percentages** - Next by thread:
**st: Confidence bands for smoothed hazard funtions** - Index(es):

© Copyright 1996–2015 StataCorp LP | Terms of use | Privacy | Contact us | What's new | Site index |