# st: Re: easy way to put frequencies distribution output in a table

 From "Martin Weiss" To Subject st: Re: easy way to put frequencies distribution output in a table Date Sat, 6 Dec 2008 15:05:59 +0100

```Mandy,

```
my intial, knee-jerk reaction from yesterday probably won`t get you the solution you want. I toyed around with your prob today and found a "downstream" solution (in NJC`s parlance from http://www.stata-journal.com/sjpdf.html?articlenum=pr0010) which does what you want...
```

*********
sysuse auto, clear
xtile quintmpg = mpg, nquantiles(5)
contract quintmpg rep78 foreign
by quint for, sort : egen float percent = pc(_freq)
format percent %3.1fc
tabdisp  rep f , cellvar(percent) by( quintmpg)
*********

HTH
Martin
_______________________
```
----- Original Message ----- From: "Mandy fu" <mandy.fu1@gmail.com>
```To: <statalist@hsphsun2.harvard.edu>
Sent: Friday, December 05, 2008 8:29 PM
Subject: st: easy way to put frequencies distribution output in a table

```
```Hi all,

distribution output  in a table?
What I want to do is to fill the following table of male and females
distribution of education attainment in each IQ score quintile( eg. to
calculate the percentages shown for quin tile 1 below)
___________________________________________

male        female

(%)             (%)
```
IQ score quintile 1 100.00 100.00
```    a. high school graduates and lower       80.00          85.00
```
b. some college 10.00 10.00 c. college graduates 8.00 6.00 d. advanced degrees 2.00 4.00
```
IQ score quintile 2
a. high school graduates and lower
b. some college

IQ score quintile 3
a. high school graduates and lower
b. some college
..........................................
__________________________________________
If I use command like:

. by    IQquintile: tabulate education  if male==1
. by    IQquintile: tabulate education  if female==1

(variable "IQquintile" means IQ score quintile. "education" is the
category variable for the four education groups seen above. )

I could get the numbers I want to fill the above table. But I need to
copy and paste each number into the table or type the numbers one by
one. This  process takes time,  if  there are lots of groups. So, I
was wondering if there's any easier way to do this.

Mandy
*
*   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/
```