use 数据.dta, clear


***************************描述性统计***************************
global control "SIZE LEV ROA GROW OCF TANG  AGE SOE INDIR TOBINQ"

*主要回归变量描述性统计（表1）
logout, save(描述性统计) excel dec(4) replace:  tabstat TC_COST TC_INCOME NTC_COST NTC_INCOME INDEX FINDEX $control,  ///
stat(N mean sd min p25 med p75  max )  format(%10.4f)  c(s)	


****************************主要实证结果******************************

*基本检验结果(表2)
xtset stkcd YEAR
xi:reg TC_COST FINDEX   $control  i.YEAR i.INDUSTRY ,cluster (stkcd) 
estimates store A1
xi:reg TC_INCOME FINDEX  $control i.YEAR i.INDUSTRY ,cluster (stkcd)  
estimates store A2
xi:reg TC_COST FINDEX   $control  i.YEAR i.INDUSTRY i.PROVINCE  ,cluster (stkcd) 
estimates store A3
xi:reg TC_INCOME FINDEX  $control  i.YEAR i.INDUSTRY i.PROVINCE ,cluster (stkcd)  
estimates store A4
xi:reg NTC_COST FINDEX   $control  i.YEAR i.INDUSTRY i.PROVINCE  ,cluster (stkcd) 
estimates store A5
xi:reg NTC_INCOME FINDEX  $control i.YEAR i.INDUSTRY i.PROVINCE  ,cluster (stkcd)  
estimates store A6
outreg2 [A1 A2 A3 A4 A5 A6] using 基本检验结果.xls, replace tstat bdec(4) tdec(4) rdec(4) drop(_IINDUSTRY* _IYEAR* _IPROVINCE*) 


*超额商业信用和商业信用二次配置检验（表3）
xtset stkcd YEAR
xi:reg  TC_RES FINDEX $control  i.YEAR i.INDUSTRY i.PROVINCE  ,cluster (stkcd)
estimates store A1
xi:reg  TC_COST c.FINDEX##c.LLOAN  $control  i.YEAR i.INDUSTRY i.PROVINCE ,cluster (stkcd)
estimates store A2   
xi:reg TC_INCOME c.FINDEX##c.LLOAN $control  i.YEAR i.INDUSTRY i.PROVINCE  ,cluster (stkcd)
estimates store A3 
xi:reg  TC_COST c.FINDEX##c.SLOAN   $control i.YEAR i.INDUSTRY i.PROVINCE  ,cluster (stkcd)
estimates store A4  
xi:reg TC_INCOME c.FINDEX##c.SLOAN $control  i.YEAR i.INDUSTRY i.PROVINCE ,cluster (stkcd)
estimates store A5   
outreg2 [A1 A2 A3 A4 A5] using 超额商业信用和商业信用二次配置检验.xls, replace tstat bdec(4) tdec(4) rdec(4) drop(_IINDUSTRY* _IYEAR* _IPROVINCE*) 

 

***************************机制检验***************************

*机制检验结果（表4）
xtset stkcd  YEAR 
xi:reg  LOAN_RES  FINDEX  $control   i.YEAR i.INDUSTRY i.PROVINCE ,cluster (stkcd)
estimates store A1
xi:reg  TC_COST LOAN_RES FINDEX  $control   i.YEAR i.INDUSTRY i.PROVINCE,cluster (stkcd)
estimates store A2
xi:reg  TC_INCOME LOAN_RES FINDEX  $control    i.YEAR i.INDUSTRY i.PROVINCE,cluster (stkcd)
estimates store A3
outreg2 [ A1 A2 A3] using 机制检验结果.xls, replace tstat bdec(4) tdec(4) rdec(4) drop(_IINDUSTRY* _IYEAR* _IPROVINCE*) 


***************************进一步分析***************************


*经济后果检验（表5）
xtset stkcd YEAR 
xi:reg f.RDRATIO FINDEX $control  i.YEAR i.INDUSTRY i.PROVINCE ,cluster (stkcd)
estimates store A1
xi:reg f.RDRATIO TC_COST FINDEX $control  i.YEAR i.INDUSTRY i.PROVINCE,cluster (stkcd)
estimates store A2 
xi:reg f.RDRATIO TC_RES FINDEX $control  i.YEAR i.INDUSTRY i.PROVINCE,cluster (stkcd)
estimates store A3 
outreg2 [A1 A2 A3] using 经济后果检验.xls, replace tstat bdec(4) tdec(4) rdec(4) drop(_IINDUSTRY* _IYEAR* _IPROVINCE*) 

*异质性分析（表6）
xtset stkcd YEAR
xi:reg TC_COST FINDEX   $control  i.YEAR i.INDUSTRY if SOE==1,cluster (stkcd) 
estimates store A1 
xi:reg TC_COST FINDEX   $control  i.YEAR i.INDUSTRY if SOE==0,cluster (stkcd) 
estimates store A2
xi:reg TC_INCOME FINDEX   $control  i.YEAR i.INDUSTRY if SOE==1,cluster (stkcd) 
estimates store A3
xi:reg TC_INCOME FINDEX   $control  i.YEAR i.INDUSTRY if SOE==0,cluster (stkcd) 
estimates store A4
outreg2 [A1 A2 A3 A4] using 异质性检验.xls, replace tstat bdec(4) tdec(4) rdec(4) drop(_IINDUSTRY* _IYEAR* _IPROVINCE*) 


***************************稳健性检验***************************

*替换自变量
xtset stkcd YEAR 
xi:reg TC_COST INDEX_BREADTH   $control  i.YEAR i.INDUSTRY i.PROVINCE,cluster (stkcd) 
estimates store A1
xi:reg TC_INCOME INDEX_BREADTH  $control i.YEAR i.INDUSTRY i.PROVINCE,cluster (stkcd)  
estimates store A2
xi:reg TC_COST INDEX_DEPTH   $control  i.YEAR i.INDUSTRY i.PROVINCE,cluster (stkcd) 
estimates store A3
xi:reg TC_INCOME INDEX_DEPTH  $control i.YEAR i.INDUSTRY i.PROVINCE,cluster (stkcd)  
estimates store A4
outreg2 [A1 A2 A3 A4] using 替换自变量.xls, replace tstat bdec(4) tdec(4) rdec(4) drop(_IINDUSTRY* _IYEAR* _IPROVINCE*) 


*排除盈余管理假设
xtset stkcd YEAR 
xi:reg TC_COST FINDEX   $control  i.YEAR i.INDUSTRY i.PROVINCE if ABDA==0 ,cluster (stkcd) 
estimates store A1
xi:reg TC_COST FINDEX  $control  i.YEAR i.INDUSTRY i.PROVINCE  if ABDA==1  ,cluster (stkcd)  
estimates store A2
xi:reg TC_INCOM FINDEX   $control  i.YEAR i.INDUSTRY i.PROVINCE if ABDA==0 ,cluster (stkcd) 
estimates store A3
xi:reg TC_INCOME FINDEX  $control i.YEAR i.INDUSTRY i.PROVINCE  if ABDA==1,cluster (stkcd)  
estimates store A4
outreg2 [A1 A2 A3 A4] using 排除盈余管理.xls, replace tstat bdec(4) tdec(4) rdec(4)   drop(_IINDUSTRY* _IYEAR* _IPROVINCE*) 

xtset stkcd YEAR 
xi:reg TC_COST FINDEX   $control  i.YEAR i.INDUSTRY i.PROVINCE if ABDA==0
estimates store A1
xi:reg TC_COST FINDEX  $control  i.YEAR i.INDUSTRY i.PROVINCE  if ABDA==1   
estimates store A2
suest A1 A2
test [A1_mean]FINDEX=[A2_mean]FINDEX 

xi:reg TC_INCOM FINDEX   $control  i.YEAR i.INDUSTRY i.PROVINCE if ABDA==0 
estimates store A3
xi:reg TC_INCOME FINDEX  $control i.YEAR i.INDUSTRY i.PROVINCE  if ABDA==1
estimates store A4
suest A3 A4
test [A3_mean]FINDEX=[A4_mean]FINDEX 


*排除地区经济发展的影响
xtset stkcd YEAR 
xi:reg TC_COST FINDEX   $control lngdpp i.YEAR i.INDUSTRY i.PROVINCE ,cluster (stkcd) 
estimates store A1
xi:reg TC_INCOME FINDEX  $control lngdpp i.YEAR i.INDUSTRY i.PROVINCE ,cluster (stkcd)  
estimates store A2
outreg2 [A1 A2] using 排除地区经济发展的影响.xls, replace tstat bdec(4) tdec(4) rdec(4)   drop(_IINDUSTRY* _IYEAR* _IPROVINCE*) 


*公司层面固定效应
xtset stkcd YEAR 
xtreg TC_COST FINDEX   $control  i.YEAR#i.i.INDUSTRY , fe  cluster (stkcd)
estimates store A1
xtreg TC_INCOME FINDEX $control  i.YEAR#i.i.INDUSTRY , fe  cluster (stkcd)
estimates store A2
outreg2 [ A1 A2] using 公司层面固定效应.xls, replace tstat bdec(4) tdec(4) rdec(4) drop(_IINDUSTRY* _IYEAR* _IPROVINCE*) 

 
*工具变量法—相邻省份均值（表7）  
xtset stkcd YEAR 
xi:ivregress2 2sls TC_COST  (FINDEX=LNINDEX_IV )   $control i.YEAR i.INDUSTRY  ,first 
est restore first  
outreg2  using 工具变量法1.xls,  cttop(first) replace tstat bdec(4) tdec(4) rdec(4)  drop(_IINDUSTRY* _IYEAR*) 
est restore second
outreg2  using 工具变量法1.xls,  cttop(second)  tstat bdec(4) tdec(4) rdec(4)   drop(_IINDUSTRY* _IYEAR*) 


xtset stkcd YEAR 
xi:ivregress2 2sls TC_INCOME  (FINDEX=LNINDEX_IV )   $control i.YEAR i.INDUSTRY   ,first 
est restore first  
outreg2  using 工具变量法2.xls,  cttop(first) replace tstat bdec(4) tdec(4) rdec(4)  drop(_IINDUSTRY* _IYEAR*) 
est restore second
outreg2  using 工具变量法2.xls,  cttop(second)  tstat bdec(4) tdec(4) rdec(4)  drop(_IINDUSTRY* _IYEAR*) 


*DID方法（表8）  
xtset stkcd YEAR 
xi:reg TC_COST  c.FINANCE##i.POST  $control  i.YEAR i.INDUSTRY i.PROVINCE  ,  cluster (stkcd)
estimates store A1
xi:reg TC_INCOME c.FINANCE##i.POST  $control  i.YEAR i.INDUSTRY i.PROVINCE , cluster (stkcd)
estimates store A2
outreg2 [A1 A2 ] using DID方法.xls, replace tstat bdec(4) tdec(4) rdec(4)  drop(_IINDUSTRY* _IYEAR* _IPROVINCE*) 

