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: how to exclude an observation when calculating the median of a group


From   Nick Cox <[email protected]>
To   "[email protected]" <[email protected]>
Subject   Re: st: how to exclude an observation when calculating the median of a group
Date   Mon, 7 Oct 2013 12:16:04 +0100

This is a FAQ, itself frequently cited on this list.

FAQ     . . Creating variables recording prop. of the other members of a group
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .  N. J. Cox
        4/05    How do I create variables summarizing for each
                individual properties of the other members of a
                group?
                http://www.stata.com/support/faqs/data-management/
                creating-variables-recording-properties/

Nick
[email protected]

On 7 October 2013 11:53, Nahla Betelmal <[email protected]> wrote:

> I wonder how to exclude an observation when calculating the median of
> a group. In other words I want to calculate the median of variable X
> for firms in a specific year and specific industry, however, I want to
> exclude each firm observation when calculating the median.
>
> if there are 6 firms in a certain  industry/year. The median will be
> calculated based on the other 4 non missing firms observations
>
> Firm   VarX    Mediam_VarX
> 1         10          based on firms 2,3,4,5 only
> 2          8           based on firms 1,3,4,5 only
> 3         12          based on firms 1,2,4,5 only
> 4          14         based on firms 1,2,3,5 only
> 5         10           based on firms 1,2,3,4 only
> 6        missing            .
>
> I am stuck with the command for the part of excluding each firm
> observation, It would be great if someone can help in that.
*
*   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