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

st: Programming a loop to exclude M&As in the 5 years prior to an M&A

From   [email protected]
To   [email protected]
Subject   st: Programming a loop to exclude M&As in the 5 years prior to an M&A
Date   Thu, 16 Oct 2008 12:03:09 +0200

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:

© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index