Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

st: Frequencies and proportions side by side in tables


From   n p <nik_padazis@yahoo.com>
To   statalist@hsphsun2.harvard.edu
Subject   st: Frequencies and proportions side by side in tables
Date   Fri, 23 Jan 2004 06:33:20 -0800 (PST)

Hi statalisters,
Is there a way to show tables of frequencies and
proportions (row or column) like in the tabulate
command but with the proportions side by side with the
frequencies?

Something like (row proportions case):


         Education Level
         High      |  Low
Gender   N (%)     |  N(%)
-------------------------------
Male     4 (40.0)  |  6  (60.0)
Female   3 (15.0)  |  17 (85.0) 
--------------------------------

I tried to implement it using something like

preserve
gen cons=1
bysort gender:egen N=sum(cons)
bysort gender education:egen n=sum(cons)
bysort gender education:keep if _n==1
gen perc=n/N*100
.
.
reshape ....
list ....
restore


but I had problems dealing with cells with zero
frequencies. I also did a quick search (findit,
archives) without success.
The primary use of such a command would be
copy-pasting in word processors.

Any help would be greatly appreciated.

Nikos Pantazis
Biostatistician MSc



__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
http://webhosting.yahoo.com/ps/sb/
*
*   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/



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