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: RE: A Previous Question on Selecting Sample from Panel Data
From
Hong Nguyen <[email protected]>
To
[email protected]
Subject
Re: st: RE: A Previous Question on Selecting Sample from Panel Data
Date
Fri, 18 Jun 2010 11:47:11 -0400
Hi Nick,
Thank you!
Your new commands work in that I could now use either 2000 or 2001 (or
both years) for selecting a sample and spread the observations to the
other years.
Hong
Nick Cox wrote:
This is not very clear. What do you mean by "seems to work, but somehow
not quite"?
gen byte OK = 1 if interestonly == 1 & (yearid == 2000 | yearid == 2001)
bysort gvkey (OK) : replace OK = OK[1]
is one way to do it.
gen byte OK == interestonly == 1 & (yearid == 2000 | yearid == 2001)
bysort gvkey (OK) : replace OK = OK[_N]
is another way to do it.
Nick
[email protected]
Hong Nguyen
The procedure (that is,
bysort firm (derivuse) : replace derivuse = derivuse[1] ==1) seems to
work, but somehow not quite.
I have 19 years (YEARID=1987, 1988, ..., 2005 already in the data set)
of financial data for 423 firms set up as panel data, each firm with a
unique GVKEY. For 2000 and 2001 only, I have a variable called
INTERESTONLY, which is either 1 or 0 for these 423 firms. What I want to
do is to pick observations for a sample of firms where INTERESTONLY=1
(in 2000 only or in 2001 only, or in either), and spread them to all
other years.
I hope this makes things clearer as to what I have and what I'd like to
be able to do.
*
* 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/