Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.
From | Christopher Baum <kit.baum@bc.edu> |
To | "statalist@hsphsun2.harvard.edu" <statalist@hsphsun2.harvard.edu> |
Subject | st: Re: Creating a dummy for each large firm in each fiscal year |
Date | Mon, 13 Jun 2011 03:16:33 -0400 |
<> No loops needed: g largefirm = (fyear==2008 & at>100 & !mi(at)) bysort gvkey: egen large = total(largefirm) On Jun 13, 2011, at 8:33 AM, Martin wrote: > Subject: st: Creating a dummy for each large firm in each fiscal year (foreach command) > > Hello, > > This is my problem. I have a sample which uniquely identifies firms by > the variable gvkey. Now I want to run a regression over firms that are > defined as large and therefore I want to create a dummy. I define > firms as large on basis of their 2008 total assets. As a result I > created a dummy variable called largefirmdummywith the command: > generate largefirmdummy=1 if fyear==2008 & at > 100. Next I entered > the following command: generate gvkeylarge = gvkey if > largefirmdummy==1. So I now have the variable gvkeylarge which > contains the gvkey of each large firm. > Kit Baum | Boston College Economics & DIW Berlin | http://ideas.repec.org/e/pba1.html An Introduction to Stata Programming | http://www.stata-press.com/books/isp.html An Introduction to Modern Econometrics Using Stata | http://www.stata-press.com/books/imeus.html * * 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/