*-------------------------------------------------------
* -Chang&Wong,2009,JCF -
* Chang, E. C., Wong, S. M. L., 2009.
* Governance with multiple objectives:
* Evidence from top executive turnover in china.
* Journal of Corporate Finance, 15(2): 230-244.
*-------------------------------------------------------
dropvars T_obs
bysort id: egen T_obs = count(id)
drop if (T_obs<4 & yesT==0)
*-9.3.2 开始配对
dropvars IND //数字类型的行业代码
encode industry, gen(IND) label(IND_lab)
tab IND
label list IND_lab
local r "roa" // [填入] 业绩指标
dropvars nn Control ratio_* n_match match_id
gen Control = . //最关键的变量, 随后填入 1(表示配对对象), 0(表示变更公司)
gen ratio_roa = . //业绩匹配规则变量
gen ratio_size = . //公司规模匹配规则变量
gen n_match = . //仅考虑 roa[-20%,+20%] 规则时,符合条件的公司数目
gen match_id =. //匹配公司的代码
gsort -TO_force
gen nn = _n if TO_force==1
browse id year TO_force nn roa
qui sum nn
local N=r(N) //待匹配的公司数目
forvalues i=1/`N'{
local roa_t0 = `r'[`i'] //变更公司的业绩
local IND_t0 = IND[`i'] //变更公司所处的行业
local size_t0 = size[`i'] //变更公司的公司规模
local yr_t0 = year[`i'] //变更年份
local id_t0 = id[`i'] //变更公司的代码
replace ratio_roa = `r'/`roa_t0' ///
if (year==`yr_t0' & IND==`IND_t0' & yesT==0)
dis in red "count"
count if (ratio_roa>0.8&ratio_roa<1.2) & ///
(year==`yr_t0') & (IND==`IND_t0') //配对公司个数
replace n_match = r(N) if nn==`i'
* set trace on //解析程序运行过程-begin-
if r(N)>1{
replace ratio_size = abs(size/`size_t0'-1) ///
if (ratio_roa>0.8&ratio_roa<1.2) & (year==`yr_t0') & ///
(yesT==0) & (IND==`IND_t0')
sum ratio_size ///
if (ratio_roa>0.8&ratio_roa<1.2) & (year==`yr_t0') & ///
(yesT==0) & (IND==`IND_t0') //找到最小值
replace Control=1 if ratio_size==r(min) & (year==`yr_t0') & (Control!=1)
*-(Control!=1) 已经设为配对组的公司不会被覆盖掉
replace match_id=`id_t0' ///
if ratio_size==r(min) & (year==`yr_t0')
}
else{
replace Control=1 ///
if (ratio_roa>0.8&ratio_roa<1.2) & (year==`yr_t0') & ///
(IND==`IND_t0') & (Control!=1)
replace match_id=`id_t0' ///
if (ratio_roa>0.8&ratio_roa<1.2) & (year==`yr_t0') & ///
(IND==`IND_t0')
}
* set trace off //解析程序运行过程-over-
}
*-9.3.3 配对情况统计
*-仅考虑 roa[-20%,+20%] 规则时,符合条件的公司数目
sort n_match id year
list id year TO_force n_match if TO_force==1, sepby(n_match)
*-谁和谁成亲了? (Control-Treat组公司代码对应关系)
gsort -Control id year
list id year Control match_id if Control==1
*-有多少变更公司找到了匹配对象?
replace Control=0 if TO_force==1 //CEO强制变更当年, Control=0
table Control TO_force
table Control TO_force year