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 at the end of May, and its replacement, statalist.org is already up and running.


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

Re: st: Creating a dummy for each large firm in each fiscal year (foreach command)


From   daniel klein <klein.daniel.81@googlemail.com>
To   statalist@hsphsun2.harvard.edu
Subject   Re: st: Creating a dummy for each large firm in each fiscal year (foreach command)
Date   Sun, 12 Jun 2011 22:21:35 +0200

I do not think the first dummy (gvkeylarge) is needed here. One way to
create the disired dummy (largefirmdummy) might be

levelsof gvkey if (fyear==2008) & (at > 100) ,loc(keys) s(,)
g byte largefirmdummy = inlist(gvkey, `keys')

The -inlist()- function will not work if there are more than about 240
large firms, though. If this is the case, you may have to create a
loop over the elements of the local. Alternatively, you may also think
about using -reshape- your data wide.

Best
Daniel
*
*   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