R. Allan Reese
> > On Mon, May 12, 2003 at 10:04:15PM +0100, SJ Friederich,
> Economics wrote:
> > > Say I have a variable taking on a large number of
> values and I am only
> > > interested in finding out how much each of the top five
> or ten values
> > > represent in terms of frequencies.
> >
> On Mon, 12 May 2003, Michael Hills wrote:
>
> > . tab X if X > x
> >
> > might work after a few stabs at different values of x.
>
> Nearly there, but in one step you can use ranks. As the
> rank function
> changes the sort order of the data, it may be advisable to save the
> current order:
>
> gen corder = _n
> egen rankx = rank(x)
> tab x if rankx < 5
>
> However, I often advise clients that a very powerful
> analysis tool is to
> sort and inspect the data editor, since you can see what
> other variables
> are odd values on the same case.
But, setting aside what happens with ties,
this is just what -extremes- can do, and
not I think Sylvain's problem.
Note that for some while now -egen- doesn't
change the sort order of observations,
so the saving of order is unnecessary.
That dates from Stata 7.
I think I have extended -extremes-
so that Sylvain can do what he wants.
We'll confer privately and report back to the
list.
Nick
[email protected]
*
* 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/