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: reading value labels -- second and third largest values


From   Nick Cox <[email protected]>
To   [email protected]
Subject   Re: st: reading value labels -- second and third largest values
Date   Wed, 5 Dec 2012 08:38:58 +0000

No and no.

I suggest you look inside the code.

gen touse = !missing(varname)
bysort touse group (varname) : gen highest = (_n >= _N - 2) & touse

tags the 3 highest values of -varname-, separately within groups of -group-.

after which you can -list- them or use them.

Nick

On Wed, Dec 5, 2012 at 8:21 AM, Jakob Pohlisch <[email protected]> wrote:
> Hello Nick,
>
> thanks for your quick answer! Is there any already build-in way to extract
> those values or will i have to manipulate your command to do so?
>
> Jakob
>
> Am 05.12.12 08:59, schrieb Nick Cox:
>>
>> On #1, you will find some technique in the code for -extremes- (SSC).
>>
>> Nick
>>
>> On Tue, Dec 4, 2012 at 10:29 PM, Jakob Pohlisch <[email protected]> wrote:
>>
>>> 1. The command summarize is computing the 4 largest and smallest values.
>>> Unfortunately the command is not storing them for the reason that it is a
>>> build in command i cannot manipulate it to do so. To get this values from
>>> a
>>> dataset is not that hard. i would just sort the values and take the
>>> values
>>> of the observations _N, _N-1 and so on. But if i would like to use the
>>> bysort "command" i would have to get the values of "subsamples" of my
>>> datatset. This is not to hard if i use the preserve and restore commands.
>>> But these commands unfortunately are VERY time-consuming. I have really
>>> big
>>> datasets on hand and would like to obtain those values without the
>>> preserve
>>> and restore commands. Any idea?
>>
>> *
>>
>> *   For searches and help try:
>> *   http://www.stata.com/help.cgi?search
>> *   http://www.stata.com/support/faqs/resources/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/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/


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