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]
Re: st: Keepping observations that satisfy a concrete feature in the last period
From
Nick Cox <[email protected]>
To
"[email protected]" <[email protected]>
Subject
Re: st: Keepping observations that satisfy a concrete feature in the last period
Date
Wed, 24 Apr 2013 13:05:07 +0100
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
[email protected]
On 24 April 2013 12:55, Miguel Angel Duran <[email protected]> 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/