Nick, thank you very much. It works (obviously).
-----Mensaje original-----
De: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] En nombre de Nick Cox
Enviado el: miércoles, 24 de abril de 2013 14:05
Para: statalist@hsphsun2.harvard.edu
Asunto: Re: st: Keepping observations that satisfy a concrete feature in the
last period
The last value observed can be put in a variable
bysort id (time) : gen lastsize = size[_N]
so that you can always -keep- or -drop- dependent on that.
For a wider-ranging survey of basic technique in this territory, see
http://www.stata-journal.com/article.html?article=dm0055
Nick
njcoxstata@gmail.com
On 24 April 2013 12:55, Miguel Angel Duran <maduran@uma.es> wrote:
> I would like to analyze separately agents that have a particular
> feature, eg their size in the last period is large. But I don't know
> how to tell Stata that the criterion is the size in the last period.
> Will anyone please help me to find out how this can be done?
>
> To illustrate what I pretend, consider this dataset:
>
> time id size
> 1 100 29
> 1 200 26
> 2 100 33
> 2 200 34
> 3 100 43
> 3 200 44
> 3 300 45
>
> Althoug id=100 is larger in the first period than id=200, I would like
> to keep id=200 (because it is larger in time=3). In addition, I would
> like to keep id=300 (that just appear in time=3).
*
* 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/