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

From |
"Nick Cox" <n.j.cox@durham.ac.uk> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
st: RE: Table of relative frequencies |

Date |
Wed, 12 Nov 2008 15:01:55 -0000 |

Consider -groups- from SSC. (There was some discussion in SJ-3-4 pr0011 . . . . . . . . Speaking Stata: Problems with tables, Part II . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . N. J. Cox Q4/03 SJ 3(4):420--439 (no commands) reviews three user-written commands (tabcount, makematrix, and groups) as different approaches to tabulation problems which is accessible to all under the Stata Journal's moving window.) Some examples follow my signature. Nick n.j.cox@durham.ac.uk . sysuse auto (1978 Automobile Data) . groups rep78, show(p) +-----------------+ | rep78 Percent | |-----------------| | 1 2.90 | | 2 11.59 | | 3 43.48 | | 4 26.09 | | 5 15.94 | +-----------------+ . groups rep78, show(p) showhead(%) +---------------+ | rep78 % | |---------------| | 1 2.90 | | 2 11.59 | | 3 43.48 | | 4 26.09 | | 5 15.94 | +---------------+ . groups rep78 if foreign, show(p) showhead(%) +---------------+ | rep78 % | |---------------| | 3 14.29 | | 4 42.86 | | 5 42.86 | +---------------+ kokootchke I have a data set that contains bonds issued by a given country at different points in time, with information about each bond. For instance, one observation would look like: country issuedate year issuer maturity yield currency amount Mexico 09May98 1998 BXN 10 8.34 USD 250 I need to create lots of tables with summary statistics such as: table country, c(m yield) However, one type of table I don't know how to create quickly is one with relative frequencies (and I'm always angry with the -table- command because it doesn't seem to allow for tables of relative frequencies, unlike -tab-... but I don't like -tab-!). What I want is a table that gives me the percentage of bonds (observations) within a given country that have maturities greater than, say, 3 years. So, I wish there was a command that looked like: table country, c(relfreq), if maturity>= 3 and produce a table like: Argentina 26.7% Brazil 37.8% Mexico 49.3% Zimbabwe 17.5% ... I know that table country if maturity>= 3 will give me the # of bonds (absolute frequency) that meet the condition (maturity>= 3)... but I want this number in percentage terms. Is there any easy way of doing this? * * 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/

**References**:**Re: st: Sort on time***From:*Svend Juul <SJ@SOCI.AU.DK>

**Re: st: Sort on time***From:*"Paul McCabe" <mcpstata@googlemail.com>

**st: Table of relative frequencies***From:*kokootchke <kokootchke@hotmail.com>

- Prev by Date:
**Re: st: variable that counts double observations..** - Next by Date:
**RE: st: variable that counts double observations..** - Previous by thread:
**st: Table of relative frequencies** - Next by thread:
**st: How low can the percentage of uncensored cases be in heckprob?** - Index(es):

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