Hi Mr. Weiss and other friends,
The solution attached in Mr. Weiss's reply works pretty well with my
problem. What's more, I find the article(two parts) are helpful to all
kinds of tables.
Thanks a lot!
Mandy
On Sat, Dec 6, 2008 at 9:05 AM, Martin Weiss <[email protected]> wrote:
> 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" <[email protected]>
> To: <[email protected]>
> Sent: Friday, December 05, 2008 8:29 PM
> Subject: st: easy way to put frequencies distribution output in a table
>
>
>> Hi all,
>>
>> Could someone please help me with an easy way to put frequencies
>> 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
>> c. college graduates
>> d. advanced degrees
>>
>> IQ score quintile 3
>> a. high school graduates and lower
>> b. some college
>> c. college graduates
>> d. advanced degrees
>> ..........................................
>> __________________________________________
>> 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.
>>
>> Thanks for your help!
>> 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/
>
*
* 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/