Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | "Miguel Angel Duran Munoz" <maduran@uma.es> |
To | statalist@hsphsun2.harvard.edu |
Subject | Re: st: Observations that keep a feature in the whole sample period |
Date | Wed, 22 May 2013 00:31:08 +0200 (CEST) |
Thanks, Nick. > Correct on -keep-. Sorry about that. > > The -sort- order > > bysort entity (const_a) : > > ensures that -const_a[1]- is the lowest for each agent, not the first. > If the lowest value for each agent is above the threshold, then all > the observations for that agent are above. > Nick > njcoxstata@gmail.com > > > On 21 May 2013 23:16, Miguel Angel Duran Munoz <maduran@uma.es> wrote: >> Thanks, Nick. I guess you mean -keep- instead of -drop-. Nevertheless, >> the >> command that you suggest would not guarantee that I keep the agents that >> have been above the threhsold for the whole sample period (ie, I would >> be >> including agents that were above the threshold in the first period and >> then might have been above or below it). >> >>> Sounds like >>> >>> bysort entity (const_a) : drop if const_a[1] > 0.09716 >>> >>> Nick >>> njcoxstata@gmail.com >>> >>> On 21 May 2013 23:01, Miguel Angel Duran Munoz <maduran@uma.es> wrote: >>>> Hi, Statalisters. I want to focus on agents in my dataset that have a >>>> particular feature; specifically, for those agents, and for each and >>>> every >>>> period (out of 64), the value of a variable (const_a) is larger than a >>>> particular threshold (0.097116). I have done what I show below. >>>> Nevertheless, I have realized that some of my agents are not in the >>>> sample >>>> since the first period, so what I am doing would mistakenly eliminate >>>> them. Will anyone help to solve this problem? Thanks in advance. >>>> >>>> bysort entity (date2): gen obs=_n >>>> drop if const_a<0.097116 >>>> by entity: drop if obs[_N]<64 >>>> >>> * >>> * 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/ > * > * 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/