Dear Mr. Nichols,
thanks a lot for the help. I guess that is what I need to identify
duplicated cusips. First I have to understand what it means as I am new
to this advanced STATA programming. Please be pationed until I grasp the
content of the commands. I work on that.
Kind regards and thanks a lot for the excellent help
Pascal Stock
> -----Ursprüngliche Nachricht-----
> Von: "Austin Nichols" <[email protected]>
> Gesendet: Do. 16.10.08 (21:31)
> An: [email protected]
> Betreff: Re: st: Programming a loop to exclude M&As in the 5 years
prior to an M&A
>
> Pascal Stock <[email protected]>:
> Is this the kind of thing you want?
>
> clear
> input acquiror_cusip target_cusip year_of_announcement
> 037833100 931142103 1990
> 037833100 931142102 1991
> 037833100 931142102 1997
> 331142103 131142102 1990
> 231142103 331142103 1993
> 931142103 231142102 1999
> end
> ren acquiror_cusip cusip0
> ren target_cusip cusip1
> ren year_of_announcement y
> g i=_n
> reshape long cusip, i(i) j(targ)
> bys cusip (y): g dropme=y[_n 1]-y<=5
> format cusip %12.0f
> li, noo sepby(cusip)
> egen todrop=max(dropme), by(i)
> drop if todrop==1
> drop dropme todrop
> reshape wide cusip, i(i) j(targ)
> ren cusip0 acquiror_cusip
> ren cusip1 target_cusip
> ren y year_of_announcement
> sort i
> drop i
> li
>
>
> On Thu, Oct 16, 2008 at 6:03 AM, <[email protected]>
> wrote:
> > Hello Statausers,
> >
> > I am new to STATA and try to program a screening loop to exclude
> from my SDC
> > M&A sample those M&As in which the acquiror or target of an M&A in
> a
> > particular year_of_announcement==`j' with j=1987-2006 has been the
> target or
> > acquiror in an M&A in one of the preceeding 5 years. This screening
> is
> > needed to avoid the problem of overlapping events in the analysis
> of the
> > stock returns after the M&A.
> >
> > My problem is how to program that STATA is supposed to look in a
> particular
> > year for all acquirors and targets that are acquirors or targets in
> one of
> > the past 5 years. The target_cusip and acquiror_cusip as
> identifiers are
> > organized in seperate colums. So STATA has to go through these two
> colums in
> > each year and look for duplicated cusips that occur already in the
> > year_of_announcement looked at.
> >
> > So far I programmed the following loop, but do not know how to
> indicate that
> > the year_of_announcement==`j' is the base year from which Stata has
> to go
> > back year by year to look for the cusips occuring in year j that
> are
> > duplicated in the previous years :
> >
> > local j=1987
> > forvalues j=1987/2006 {
> >
> > drop if acquiror_cusip==acquiror_cusip &
> year_of_announcement==`j'-1
> > drop if acquiror_cusip==target_cusip &
> year_of_announcement==`j'-1
> > drop if target_cusip==target_cusip &
> year_of_announcement==`j'-1
> > drop if target_cusip==acquiror_cusip &
> year_of_announcement==`j'-1
> >
> > drop if acquiror_cusip==acquiror_cusip &
> year_of_announcement==`j'-2
> > drop if acquiror_cusip==target_cusip &
> year_of_announcement==`j'-2
> > drop if target_cusip==target_cusip &
> year_of_announcement==`j'-2
> > drop if target_cusip==acquiror_cusip &
> year_of_announcement==`j'-2
> >
> > drop if acquiror_cusip==acquiror_cusip &
> year_of_announcement==`j'-3
> > drop if acquiror_cusip==target_cusip &
> year_of_announcement==`j'-3
> > drop if target_cusip==target_cusip &
> year_of_announcement==`j'-3
> > drop if target_cusip==acquiror_cusip &
> year_of_announcement==`j'-3
> >
> > drop if acquiror_cusip==acquiror_cusip &
> year_of_announcement==`j'-4
> > drop if acquiror_cusip==target_cusip &
> year_of_announcement==`j'-4
> > drop if target_cusip==target_cusip &
> year_of_announcement==`j'-4
> > drop if target_cusip==acquiror_cusip &
> year_of_announcement==`j'-4
> >
> > drop if acquiror_cusip==acquiror_cusip &
> year_of_announcement==`j'-5
> > drop if acquiror_cusip==target_cusip &
> year_of_announcement==`j'-5
> > drop if target_cusip==target_cusip &
> year_of_announcement==`j'-5
> > drop if target_cusip==acquiror_cusip &
> year_of_announcement==`j'-5
> > }
> >
> > I gues a command with a varlist like forvalues j=1987/2006 of
> varlist
> > year_of_announcement {.....}
> >
> > Kind regards
> >
> > Pascal Stock
> *
> * 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/
>
>
>
> -----Ursprüngliche Nachricht Ende-----
Unbegrenzter Speicher, Top-Spamschutz, 120 SMS und eigene
E-MailDomain
inkl.
http://office.freenet.de/dienste/emailoffice/produktuebersicht/power/mail/index.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/