Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: RE: A Previous Question on Selecting Sample from Panel Data


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   st: RE: A Previous Question on Selecting Sample from Panel Data
Date   Fri, 18 Jun 2010 16:14:56 +0100

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 
n.j.cox@durham.ac.uk 

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/


© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index