Statalist


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

st: Re: Deleting Only Particular Observations


From   "Martin Weiss" <martin.weiss1@gmx.de>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: Re: Deleting Only Particular Observations
Date   Wed, 1 Jul 2009 22:44:18 +0200

<>

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ß" <christian.weiss@ebs.edu>
To: <statalist@hsphsun2.harvard.edu>
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/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index