Statalist


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

st: Re: Re: Deleting Only Particular Observations


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: Re: Re: Deleting Only Particular Observations
Date   Wed, 1 Jul 2009 22:54:15 +0200

<>

As always you want to be extra careful with missings which in Stata count as larger than large... Maaarten`s solution could be preferable in this respect...


HTH
Martin
_______________________
----- Original Message ----- From: "Martin Weiss" <[email protected]>
To: <[email protected]>
Sent: Wednesday, July 01, 2009 10:44 PM
Subject: st: Re: Deleting Only Particular Observations


<>

Ignore last email, sorry, knee jerk reaction. Here is a better idea:

***
clear*

//100 countries
set obs 100

//countries
gen country=_n

//200 firms per country
expand 200

gen size=rnormal(100000,10000)


//keep the biggest 100
sort country size
by country: keep if (_N-_n)<100
***



HTH
Martin
_______________________
----- Original Message ----- From: "Christian Weiß" <[email protected]>
To: <[email protected]>
Sent: Wednesday, July 01, 2009 10:24 PM
Subject: st: Deleting Only Particular Observations


Dear Statalist,

Variable size contains the marketcap of about 2000 firms from 11
countries (grouping var country).

I would like to keep only the 100 biggest firms (by marketcap) from
each country, and delete the residual observations.

How can I accomplish this?

Best regards
Christian
*
*   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/


*
*   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/


*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index