Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


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

Re: st: tab most frequently occurring


From   Scott Merryman <[email protected]>
To   [email protected]
Subject   Re: st: tab most frequently occurring
Date   Wed, 17 Mar 2010 09:29:48 -0500

Nick Cox's -groups- can handle (a):


. sysuse auto, clear
(1978 Automobile Data)

. groups gear, select(5) order(h)

  +------------------------------------+
  | gear_r~o   Freq.   Percent    Cum. |
  |------------------------------------|
  |     2.73       9     12.16   12.16 |
  |     2.93       8     10.81   22.97 |
  |     3.08       7      9.46   32.43 |
  |     2.47       5      6.76   39.19 |
  |     2.41       3      4.05   43.24 |
  +------------------------------------+

. groups gear, select(freq>=3) order(h)

  +------------------------------------+
  | gear_r~o   Freq.   Percent    Cum. |
  |------------------------------------|
  |     2.73       9     12.16   12.16 |
  |     2.93       8     10.81   22.97 |
  |     3.08       7      9.46   32.43 |
  |     2.47       5      6.76   39.19 |
  |     2.41       3      4.05   43.24 |
  |------------------------------------|
  |     3.05       3      4.05   47.30 |
  |     3.54       3      4.05   51.35 |
  |     3.78       3      4.05   55.41 |
  +------------------------------------+


Scott


On Wed, Mar 17, 2010 at 8:30 AM, Richard Goldstein
<[email protected]> wrote:
> I want to -tabulate- a variable with many (hundreds if not thousands of)
> different values; but, I only want to see (a) the 20 (say) most
> frequently occurring values and then (b) I want a row for "all others"
> and then (c) I want a grand total row
>
> I have searched in various ways for already existing programs but, of
> course, I may have missed something (as far as I can see, -fre- will not
> do what I want but I would be happy to be shown that I was wrong)
>
> so, two questions:
>
> does anyone know of an already existing program for this?
>
> hints, etc. for writing my own would be welcome also if anyone has any
>
> thanks,
>
> Rich
*
*   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/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index