代码拉取完成,页面将自动刷新
*! 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
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。