The extracts for public release are from an initial ‘raw’ version that is produced right after the Excel files produced by our coders are read in, fields are renamed for consistency, and some very basic cleaning is carried out. The extracts do not include our own transformations or created variables. The field names in our own working file are mostly in pinyin, though some are in English, and they tend to be ad hoc, so we rename all fields to match the ones in the User Guide. The code that renames the variables is at the bottom.
1900/1912 Jinshenlu Public Release
clear
cd "`directory'"
use "Current/CGED-Q JSL from xls - renamed" if year >= 1900 & xuhao < 20000
keep xuhao-juewei year season banben_nianhao banben_jijie
replace year = int(year)
drop jicheng_hao pdf_yema
order year xuhao interpol juanhao cehao shuming banben banben_nianhao banben_niandai banben_ganzhi ///
banben_jijie wenjian_yema diqu diming_titou jigou_1 jigou_2 jigou_3 diyu_yaojin diyu_pinan_chengdu guanzhi guanzhi_2 ///
guanxian_yaojin guanxian_pinan_chengdu jiaji jiaji_jungong juewei shenfen xing ming zihao ///
ji_sheng ji_xian ren_sheng ren_xian minzu qifen chushen_1 ganzhi_1 chushen_2 ganzhi_2 quanxuan_nianhao ///
quanxuan_niandai quanxuan_run quanxuan_yue quanxuan_fangshi
replace diyu_yaojin = guanxian_yaojin if guanxian_yaojin != ""
replace diyu_pinan_chengdu = guanxian_pinan_chengdu if guanxian_yaojin != ""
drop guanxian_yaojin guanxian_pinan_chengdu
ds, has(type string)
local strvars "`r(varlist)'"
foreach x of varlist `strvars' {
replace `x' = trim(`x')
}
do "Do files/Extracts/Rename for Release"
label drop _all
local note_time_stamp "`c(current_date)'"
generate 季节号 = 0
replace 季节号 = 1 if 版本季节 == "春"
replace 季节号 = 2 if 版本季节 == "夏"
replace 季节号 = 3 if 版本季节 == "秋"
replace 季节号 = 4 if 版本季节 == "冬"
sort 阳历年份 季节号 序号 插补号
order 阳历年份 季节号
compress
save "${export_directory}/Public Release/CGED-Q Public Release 1900-1912 `note_time_stamp'", replace
export delimited using "${export_directory}/Public Release/CGED-Q Public Release 1900-1912 `note_time_stamp'.tab", replace delimiter(tab)
export excel using "${export_directory}/Public Release/CGED-Q Public Release 1900-1912 `note_time_stamp'.xlsx", replace firstrow(variables)
rename 阳历年份 yangli_nianfen
rename 季节号 jijie_hao
rename 序号 xuhao
rename 插补号 chabuhao
rename 卷号 juanhao
rename 册号 cehao
rename 书名 shuming
rename 出版单位 chuban_danwei
rename 版本年号 banben_nianhao
rename 版本年代 banben_niandai
rename 版本干支 banben_ganzhi
rename 版本季节 banben_jijie
rename 页码 yema
rename 地区 diqu
rename 地名_题头 diming_titou
rename 机构一 jigou_1
rename 机构二 jigou_2
rename 机构三 jigou_3
rename 缺分 quefen
rename 官缺等级 guanque_dengji
rename 官职一 guanzhi_1
rename 官职二 guanzhi_2
rename 加级 jiaji
rename 加级军功 jiaji_jungong
rename 爵位 juewei
rename 身份一 shenfen_1
rename 姓 xing
rename 名 ming
rename 字号 zihao
rename 原籍省 yuanji_sheng
rename 原籍县 yuanji_xian
rename 籍贯省 jiguan_sheng
rename 籍贯县 jiguan_xian
rename 身份二 shenfen_2
rename 旗分 qifen
rename 出身一 chushen_1
rename 出身二 chushen_2
rename 科年一 kenian_1
rename 科年二 kenian_2
rename 铨选年号 quanxuan_nianhao
rename 铨选年代 quanxuan_niandai
rename 铨选闰月 quanxuan_runyue
rename 铨选月 quanxuan_yue
rename 铨选方式 quanxuan_fangshi
export delimited using "${export_directory}/Public Release/CGED-Q Public Release 1900-1912 pinyin variable names `note_time_stamp'.tab", replace delimiter(tab)
rename yangli_nianfen year
replace year = year+0.25 if jijie_hao == 2
replace year = year+0.50 if jijie_hao == 3
replace year = year+0.75 if jijie_hao == 4
rename chabuhao interpol
merge 1:1 year xuhao interpol using "Current/CGED-Q JSL", keepusing(unique_id) keep(match master) nogenerate
replace year = int(year)
rename year yangli_nianfen
rename interpol chabuhao
save "${export_directory}/Public Release/CGED-Q Public Release 1900-1912 with unique IDs `note_time_stamp'", replace
export delimited using "${export_directory}/Public Release/CGED-Q Public Release 1900-1912 with unique IDs `note_time_stamp'.tab", replace delimiter(tab)
clear
1850-1864 Jinshenlu Public Release
clear
cd "`directory'"
use "Current/CGED-Q JSL from xls - renamed" if (year >= 1850 & year <= 1864) & xuhao < 20000
keep xuhao-juewei year season banben_nianhao banben_jijie
replace year = int(year)
drop jicheng_hao pdf_yema
order year xuhao interpol juanhao cehao shuming banben banben_nianhao banben_niandai banben_ganzhi ///
banben_jijie wenjian_yema diqu diming_titou jigou_1 jigou_2 jigou_3 diyu_yaojin diyu_pinan_chengdu guanzhi guanzhi_2 ///
guanxian_yaojin guanxian_pinan_chengdu jiaji jiaji_jungong juewei shenfen xing ming zihao ///
ji_sheng ji_xian ren_sheng ren_xian minzu qifen chushen_1 ganzhi_1 chushen_2 ganzhi_2 quanxuan_nianhao ///
quanxuan_niandai quanxuan_run quanxuan_yue quanxuan_fangshi
replace diyu_yaojin = guanxian_yaojin if guanxian_yaojin != ""
replace diyu_pinan_chengdu = guanxian_pinan_chengdu if guanxian_yaojin != ""
drop guanxian_yaojin guanxian_pinan_chengdu
ds, has(type string)
local strvars "`r(varlist)'"
foreach x of varlist `strvars' {
replace `x' = trim(`x')
}
do "Do files/Extracts/Rename for Release"
label drop _all
local note_time_stamp "`c(current_date)'"
generate 季节号 = 0
replace 季节号 = 1 if 版本季节 == "春"
replace 季节号 = 2 if 版本季节 == "夏"
replace 季节号 = 3 if 版本季节 == "秋"
replace 季节号 = 4 if 版本季节 == "冬"
sort 阳历年份 季节号 序号 插补号
order 阳历年份 季节号
compress
save "${export_directory}/Public Release/CGED-Q Public Release 1850-1864 `note_time_stamp'", replace
*outsheet using "${export_directory}CGED-Q Public Release 1900-1912 `note_time_stamp'.txt", replace
export delimited using "${export_directory}/Public Release/CGED-Q Public Release 1850-1864 `note_time_stamp'.tab", replace delimiter(tab)
export excel using "${export_directory}/Public Release/CGED-Q Public Release 1850-1864 `note_time_stamp'.xlsx", replace firstrow(variables)
rename 阳历年份 yangli_nianfen
rename 季节号 jijie_hao
rename 序号 xuhao
rename 插补号 chabuhao
rename 卷号 juanhao
rename 册号 cehao
rename 书名 shuming
rename 出版单位 chuban_danwei
rename 版本年号 banben_nianhao
rename 版本年代 banben_niandai
rename 版本干支 banben_ganzhi
rename 版本季节 banben_jijie
rename 页码 yema
rename 地区 diqu
rename 地名_题头 diming_titou
rename 机构一 jigou_1
rename 机构二 jigou_2
rename 机构三 jigou_3
rename 缺分 quefen
rename 官缺等级 guanque_dengji
rename 官职一 guanzhi_1
rename 官职二 guanzhi_2
rename 加级 jiaji
rename 加级军功 jiaji_jungong
rename 爵位 juewei
rename 身份一 shenfen_1
rename 姓 xing
rename 名 ming
rename 字号 zihao
rename 原籍省 yuanji_sheng
rename 原籍县 yuanji_xian
rename 籍贯省 jiguan_sheng
rename 籍贯县 jiguan_xian
rename 身份二 shenfen_2
rename 旗分 qifen
rename 出身一 chushen_1
rename 出身二 chushen_2
rename 科年一 kenian_1
rename 科年二 kenian_2
rename 铨选年号 quanxuan_nianhao
rename 铨选年代 quanxuan_niandai
rename 铨选闰月 quanxuan_runyue
rename 铨选月 quanxuan_yue
rename 铨选方式 quanxuan_fangshi
export delimited using "${export_directory}/Public Release/CGED-Q Public Release 1850-1864 pinyin variable names `note_time_stamp'.tab", replace delimiter(tab)
rename yangli_nianfen year
replace year = year+0.25 if jijie_hao == 2
replace year = year+0.50 if jijie_hao == 3
replace year = year+0.75 if jijie_hao == 4
rename chabuhao interpol
merge 1:1 year xuhao interpol using "Current/CGED-Q JSL", keepusing(unique_id) keep(match master) nogenerate
replace year = int(year)
rename year yangli_nianfen
rename interpol chabuhao
save "${export_directory}/Public Release/CGED-Q Public Release 1850-1864 with unique IDs `note_time_stamp'", replace
export delimited using "${export_directory}/Public Release/CGED-Q Public Release 1850-1864 with unique IDs `note_time_stamp'.tab", replace delimiter(tab)
clear
Code for renaming variables for the public release
rename year 阳历年份
rename season 季节
rename xuhao 序号
rename interpol 插补号
rename juanhao 卷号
rename cehao 册号
rename shuming 书名
rename banben 出版单位
rename banben_nianhao 版本年号
rename banben_niandai 版本年代
rename banben_ganzhi 版本干支
rename banben_jijie 版本季节
rename wenjian_yema 页码
rename diqu 地区
rename diming_titou 地名_题头
rename jigou_1 机构一
rename jigou_2 机构二
rename jigou_3 机构三
rename diyu_yaojin 缺分
rename diyu_pinan_chengdu 官缺等级
rename guanzhi 官职一
rename guanzhi_2 官职二
rename jiaji 加级
rename jiaji_jungong 加级军功
rename juewei 爵位
rename shenfen 身份一
rename xing 姓
rename ming 名
rename zihao 字号
rename ji_sheng 原籍省
rename ji_xian 原籍县
rename ren_sheng 籍贯省
rename ren_xian 籍贯县
rename minzu 身份二
rename qifen 旗分
rename chushen_1 出身一
rename chushen_2 出身二
rename ganzhi_1 科年一
rename ganzhi_2 科年二
rename quanxuan_nianhao 铨选年号
rename quanxuan_niandai 铨选年代
rename quanxuan_run 铨选闰月
rename quanxuan_yue 铨选月
rename quanxuan_fangshi 铨选方式