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]

From |
"Martin Weiss" <martin.weiss1@gmx.de> |

To |
<statalist@hsphsun2.harvard.edu> |

Subject |
AW: st: RE: RE: A Question on Selecting a Sample from a Panel Data Set |

Date |
Tue, 15 Jun 2010 23:54:15 +0200 |

<> ************* bysort firm (derivuse): /* */ replace derivuse = derivuse[1] == 1 | /* */ derivuse[2] == 1 ************* HTH Martin -----Ursprüngliche Nachricht----- Von: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von Hong Nguyen Gesendet: Dienstag, 15. Juni 2010 23:47 An: statalist@hsphsun2.harvard.edu Betreff: Re: st: RE: RE: A Question on Selecting a Sample from a Panel Data Set Hi Nick, I have two years of derivative use data (2000 and 2001). I could select a sample of firms based on derivative use in either 2000 or 2001 (and spread that property to other observations for the same firms). How would I modify your previous commands to fit this situation? Thanks! Hong Nick Cox wrote: > Not quite. > > -derivuse- is undefined, namely missing, for years not 2000. You need to > spread that property to other observations for the same firms. > > bysort firm (derivuse) : replace derivuse = derivuse[1] == 1 > > Nick > n.j.cox@durham.ac.uk > > Martin Weiss > > If your dataset looks like this: > > *********** > clear* > > set obs 19 > gen int year=_n+1986 > > //10 firms > expand 10 > bys year: gen byte firm =_n > gen byte derivuse=runiform()>.25 if year==2000 > *********** > > you can simply condition on -if derivuse==1- in your analyses. > > Hong Nguyen > > I have a panel data set consisting of financial data for 423 firms over > a 19-year period. For one of the years (2000) I have data on > derivatives use (use or non-use) for these 423 firms. I need to generate > > a sample of firms that used derivatives in 2000 and use it to run > regressions over the entire period 1987-2005. This is where I'm stuck. > > * > * 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/ * * 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/

**Follow-Ups**:**RE: st: RE: RE: A Question on Selecting a Sample from a Panel Data Set***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**References**:**st: A Question on Selecting a Sample from a Panel Data Set***From:*Hong Nguyen <nguyen@scranton.edu>

**st: RE: RE: A Question on Selecting a Sample from a Panel Data Set***From:*"Nick Cox" <n.j.cox@durham.ac.uk>

**Re: st: RE: RE: A Question on Selecting a Sample from a Panel Data Set***From:*Hong Nguyen <nguyen@scranton.edu>

- Prev by Date:
**Re: st: RE: RE: A Question on Selecting a Sample from a Panel Data Set** - Next by Date:
**st: RE: AW: Problems that seem to be the result of a "long command line" in a do file** - Previous by thread:
**Re: st: RE: RE: A Question on Selecting a Sample from a Panel Data Set** - Next by thread:
**RE: st: RE: RE: A Question on Selecting a Sample from a Panel Data Set** - Index(es):