全部版块 我的主页
论坛 计量经济学与统计论坛 五区 数据交流中心
29785 62
2017-08-10
    本来想自己编程匹配数据,但发现BRANDT(Brandt, L., et al. (2012). "Creative accounting or creative destruction? Firm-level productivity growth in Chinese manufacturing."Journal of Development Economic 97(2): 339-351.)已经将自己的匹配代码公布了,因此只要将其公布的程序修改即可用于匹配。
    BRANDT的个人网址为:http://feb.kuleuven.be/public/n07057/China/

    经过各个变量的初步处理,然后将主要用于匹配的变量变成字符串格式,然后将用于匹配和想要保留的变量翻译成英文如下:
*首先将变量名改为:
*法人代码-firm_id                     字符串
*企业名称-firm_name               字符串
*法人-legal_person                   字符串
*乡镇-town                              字符串
*地址-adress                            字符串
*行政区码-region_code            字符串
*电话-telephone                       字符串
*邮编-zip                                  字符串
*产品1-product1                      字符串
*行业代码-cic                           字符串
*开工年-founding_year            字符串
*开工月-founding_month         字符串  
*从业人数-employment
*产品销售收入-sales_revenue
*主营业务收入-operating_revenue
*利润总额-total_profit
*控股-shareholder
*营业状态-status
*工业总产值现价-industrial_output
*新产品产值-new_product
*工业销售产值-sales_output
*出口交货值-exported
*工业增加值-added_value
*流动资产合计-current_assets
*固定资产合计-fixed_assets
*固定资产原价-original_value_fixed_assets
*累计折旧-accumulated_depreciation
*本年折旧-depreciation
*固定资产净值均额-net_fixed_assets
*无形资产-intangible_assets
*资产总计-total_assets
*负债合计-total_liabilities
*所有者权益合计-ownership
*实收资本-paid_in_capital
*国家资本-national_capital
*集体资本-collective_capital
*法人资本-corporate_capital
*个人资本-personal_capital
*港澳台资本-gat_capital
*外商资本-foreign_capital
*利息支出-interest_paid
*补贴收入-subsidized_income
*利税总额-total_tax
*应交所得税-income_tax
*应付工资总额-total_wage
*应付福利总额-total_walfare
*应交增值税-value_added_tax
*中间投入合计-intermediate_inputs

    修改完变量名后将各年数据保存到桌面,然后名字改为original_i.dta,其中i为1998-2007。保存好文件后就可以进行“年内匹配”这一步骤了,年内匹配完成后将在STATA14目录下生成这一阶段的名为mi.dta的数据文件。将BRANDT的程序修改如下:

forvalues i = 1998/2007{  
    disp "File `i'"  
    use `"C:\Users\dell-pc\Desktop\工业企业数据库-处理结果\original_`i'.dta"',clear  
    gen id_in_source = _n  
*需要用到收入,但2004年以前的变量为产品销售收入,2004年及以后为营业收入,因此需要统一:
    if year<2004{  
        gen revenue = sales_revenue  
    }  
    else{  
        gen revenue = operating_revenue  
    }  
*生成利润这一变量用于匹配:
    gen profit = total_profit  
*保留用于匹配的变量和自己想要保存的变量:
    keep id_in_source firm_id firm_name legal_person town province  telephone zip product1 founding_year founding_month cic region_code revenue employment profit shareholder status industrial_output new_product sales_output exported added_value current_assets fixed_assets original_value_fixed_assets accumulated_depreciation depreciation intangible_assets total_assets total_liabilities ownership paid_in_capital national_capital collective_capital corporate_capital personal_capital gat_capital foreign_capital interest_paid subsidized_income total_tax income_tax total_wage total_walfare value_added_tax intermediate_inputs year
    destring founding_year revenue employment profit,replace force
        destring cic,replace
    tostring cic,replace format(%04.0f)  
    rename firm_id id  
    rename firm_name name  
    rename founding_year bdat  
    rename region_code dq  
    rename product1 product1_  
    rename telephone phone  
    foreach var of varlist *{  
        rename `var' `var'`i'  
    }  
    compress  
*保存名为mi.dta的运算结果:
    saveold m`i'.dta,replace  
}  
*简单表述下运算结果生成的数据文件:
forval i =1998/2007{  
    use m`i'.dta,clear  
    des,short  
}  


    年内匹配的结果mi.dta生成以后,就可以进行临近两年的样本匹配了。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2017-8-10 18:41:24
这一阶段的数据处理,大家可以根据自己的需要进行,将上述程序修改即可。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2017-9-1 16:50:15
这个系列超牛
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2017-9-3 11:23:54
请问下,年内配对什么意思?是不同年份内的企业配对?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2017-9-5 16:09:22
蘿蔔thr 发表于 2017-9-3 11:23
请问下,年内配对什么意思?是不同年份内的企业配对?
就是将各年分别进行变量处理的意思,让这些变量经过处理可以用于接下来的匹配,用“年内匹配”这个词可能不太准确,BRANDT这么写我就这么写了。
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2017-9-5 16:26:31
liuyangclick 发表于 2017-9-5 16:09
就是将各年分别进行变量处理的意思,让这些变量经过处理可以用于接下来的匹配,用“年内匹配”这个词可能 ...
我的是需要进行年间匹配,比如2007年与2013年的数据需要找到其中相同的企业,我应该怎么做呢?
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

点击查看更多内容…
栏目导航
热门文章
推荐文章

说点什么

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群