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: Re: Delete companies based on observations


From   "M@rk " <[email protected]>
To   <[email protected]>
Subject   st: Re: Delete companies based on observations
Date   Wed, 13 Nov 2013 11:23:15 +0100

Dear Nick,

That is indeed what I meant. Thanks for your help! Now I am able to proceed with my research.

Kind Regards,

Mark Krap

-----Oorspronkelijk bericht----- From: Nick Cox
Sent: Wednesday, November 13, 2013 11:08 AM
To: [email protected]
Subject: Re: st: Delete companies based on observations

Various errors here:

1. -drop- doesn't support a -by()- option: if it did, that would be documented.

2. There is no -count- function in Stata. Perhaps you mean the -count-
command. (-egen- supports a -count()- function, here meaning
(confusingly) an -egen- function, not a Stata function.)

3. _n only ever refers to observation identifiers in sequence; you want _N.

4. -comnam[_n]- is the current value of -comnam-, not its frequency of
occurrence.

That said,

bysort comnam : drop if _N <= 13

is what you want.

Nick
[email protected]

Mark Krap

 I need to delete all companies of which I have equal or less
than 13 observations. I already tried the following commands, without the
desired result.

drop if _n<=13, by(comnam)

drop if comnam[_n]<=13

I assume that the count funtion in Stata can help me to delete these
companies, but I do not know how to incorporate this in a command in order
to do the deletions.
*
*   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