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]

st: how to exclude an observation when calculating the median of a group


From   Nahla Betelmal <[email protected]>
To   "[email protected]" <[email protected]>
Subject   st: how to exclude an observation when calculating the median of a group
Date   Mon, 7 Oct 2013 11:53:45 +0100

Dear Statalist members,

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.

Many thanks in advance

Nahla Betelmal
*
*   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