1 Star 1 Fork 11

连享会/Stata-Event_Study

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
fix_country_names.ado 1.59 KB
一键复制 编辑 原始数据 按行查看 历史
Richard Herron 提交于 2017-02-20 10:24 . Added areg to fm.ado
*! 0.1 Richard Herron 2/11/2014
/* use to standardize country names across several data sources */
program fix_country_names
version 11.2
syntax varname(string) [, Suffix(string) ]
tokenize `varlist'
quietly {
/* default suffix */
if "`suffix'" == "" local suffix "_0"
/* save original as new variable w/ suffix */
rename `1' `1'`suffix'
/* first standardize capitalization */
generate `1' = proper(`1'`suffix')
/* -if- picks up bad names from any source;
i.e., write once, run everywhere */
replace `1' = "Czech Republic" ///
if inlist(`1', "Czech Rep.")
replace `1' = "Hong Kong" ///
if inlist(`1', "Hong Kong SAR, China")
replace `1' = "Kazakhstan" ///
if inlist(`1', "Kazahkstan")
replace `1' = "Korea" ///
if inlist(`1', "Korea (Rep.)", "Korea, Rep.", "Korea (South)")
replace `1' = "Russia" ///
if inlist(`1', "Russian Federation")
replace `1' = "Slovak Republic" ///
if inlist(`1', "Slovak Rep.", "Slovakia")
replace `1' = "United States" ///
if inlist(`1', "USA", "Usa", "U.S.A.", "U.s.a.")
replace `1' = "Venezuela" ///
if inlist(`1', "Venezuela, RB", "Venezuela, Rb")
replace `1' = "Virgin Islands (Brit)" ///
if inlist(`1', "Virgin Islands(Brit)")
/* fix labels */
local name: variable label `1'`suffix'
label variable `1' "`name'"
label variable `1'`suffix' "`name' (orig)"
}
end
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/arlionn/Stata-Event_Study.git
git@gitee.com:arlionn/Stata-Event_Study.git
arlionn
Stata-Event_Study
Stata-Event_Study
master

搜索帮助