Cameron D. Campbell 康文林

Family, Social Mobility, and Inequality in China and in Comparative Perspective

Menu
  • Research
    • Abridged CV
    • Full CV (PDF)
    • 2 page CV (PDF)
    • Google Scholar
    • 百度学术
    • ORCID
    • HKUST Repository
  • News
  • Data
    • China Government Employee Database – Qing (CGED-Q) 中国历史官员量化数据库(清代)
      • Download Data
      • Search by Name
      • CGED-Q Jinshenlu Public Release – Resources for Users
    • China Multigenerational Panel Databases 中國多代人口数据庫
      • Download Data
  • Lee-Campbell Group
    • People
    • Projects
    • Publications
  • Photography
    • Photo site 摄影网站
    • Map view
    • Updates
  • Contact
Menu

Recoding and Re-Categorizing Variables

出身 Chushen

Download 出身 Chushen recode table as a Stata .dta file

Through a merge, this groups the original 出身 chushen into a limited number of categories, with two levels of detail.

This file was originally created by Bijia Chen, and was added to by Cameron Campbell.

Below is an example of use. The code assumes of the public release files is already loaded in STATA, and the Chushen recodes file is placed in the current working directory. chushen_category is the detailed chushen category as a string, and chushen_order is a numeric version. chushen_order_2 has broader categories, and chushen_order_2_eng is English.

Remember that in some editions, 进士 and 举人 are not recorded in 出身, which may be blank. In those editions, holders of 进士 or 举人 may be identified by the presence in 科年一 of a 干支 that matches an exam year. Please see the User Guide discussion of 出身. In our own work we match 科年一 against exam years to ascertain exam degrees, but this is rather involved, and we are not ready to release the relevant code.

merge m:1 出身一 using "CGED-Q JSL Public Release Chushen Recodes.dta", keep(match master)
replace chushen_category = "其他" if _merge == 1
replace chushen_order_2_eng = "Other" if _merge == 1
replace chushen_order = 12 if _merge == 1
replace chushen_order_2 = 12 if _merge == 1
drop _merge 

地区 Region of post

The following will help make 地区 more consistent across editions. It does not ‘correct’ 地区 since it can change from edition to edition based on changes in the definition of administrative units. Rather, it reassigns some regions to group with their most commonly observed administrative unit. For example, some newly formed administrative units are reassigned to their original units, for the purpose of making definitions consistent across editions.

generate 地区_original = 地区
replace 地区 = "不顯" if 地区 == "" | 地区 == "503"
replace 地区 = "甘肅省" if 地区 == "甘肅新疆" | 地区 == "甘肅新疆省"
replace 地区 = "盛京" if 地区 == "吉林甯古塔城" | 地区 == "吉林省" | 地区 == "黑龍江城" | 地区 == "黑龍江城" | 地区 == "黑龍江省" | 地区 == "奉天省"
replace 地区 = "江蘇省" if 地区 == "江南省" & (机构一 == "太湖廰" | 机构一 == "常州府" |  机构一 == "徐州府" | 机构一 == "揚州府" | 机构一 == "松江府" | 机构一 == "江寕府" | 机构一 == "江甯府" | 机构一 == "淮安府" | 机构一 == "蘇州府" |  机构一 == "鎭江府" | 机构一 == "鎮江府")
replace 地区 = "江蘇省" if 地区 == "江南省" & (ustrpos(机构一,"海門") | ustrpos(机构一,"太倉") | ustrpos(机构一,"海門") | ustrpos(机构一,"淮安") | ustrpos(机构一,"通州") | ustrpos(机构一,"海州") | ustrpos(机构一,"兩淮") | ustrpos(机构一,"海州") | ustrpos(机构一,"江寕") | ustrpos(机构一,"江甯") | ustrpos(机构一,"江蘇") | ustrpos(机构一,"鎮江")) 
replace 地区 = "陝西省" if 地区 == "陜西省"
replace 地区 = "直隸省" if 地区 == "直隷省"

籍貫省 Province of origin

Download 籍貫省 Province of origin recode table – as a Stata .dta file

Through a merge, this file helps clean up and make consistent the original 籍貫省 province of origin. We have included some additional code to handle 江南 Jiangnan when the 籍贯县 county of origin is also available.
After the merge, the new variable 籍貫省_clean will contain the ‘cleaned’ province names, and should be suitable for tabulations.

Example of use, assuming one of the public release files is already loaded in STATA, and the Chushen recodes file is placed in the current working directory:

merge m:1 籍贯省 using "CGED-Q JSL Public Release Province of Origin 籍貫省 Recodes.dta",keep(match master) nogenerate
replace 籍貫省_clean = "安徽" if (籍贯县 == "亳州" | 籍贯县 =="休寧" | 籍贯县 =="婺源" | 籍贯县 == "宣城" | 籍贯县 == "巢縣" | 籍贯县 =="旌德" | 籍贯县 =="桐城" | 籍贯县 =="歙縣" | 籍贯县 =="涇縣" | 籍贯县 =="滁州" | 籍贯县 =="當塗" | 籍贯县 =="蕪湖" | 籍贯县 == "遂寧" | 籍贯县 == "銅山" | 籍贯县 == "霍邱" | 籍贯县 =="青陽" | 籍贯县 =="靑陽" | 籍贯县 =="太平" | 籍贯县 == "上元") & 籍贯省 == "江南"
replace 籍貫省_clean = "江西" if (籍贯县 == "南豊" | 籍贯县 =="撫州" | 籍贯县 =="鄱陽" | 籍贯县 == "豐城" | 籍贯县 == "萍鄉") & 籍贯省 == "江南"
replace 籍貫省_clean = "浙江" if 籍贯县 == "桐鄉" & 籍贯省 == "江南"

After this cleanup, you may notice many provinces of origin are still blank. In the original source, if an official was serving in their province of origin, the province of origin was left blank, and we can assume that their province of origin is where they are currently serving (地区). The following command transfers the contents of 地区 to 籍贯省. It isn’t perfect, but it is enough for a first pass.

replace 籍貫省_clean = usubinstr(地区,"省","",.) if 籍貫省_clean == "空白"

旗分 Banner

The following code will clean up the contents of the 旗分 Banner variable:

generate 旗分_original = 旗分 
replace 旗分 = usubinstr(旗分,"旗","",.) if strpos(旗分,"旗人") == 0
replace 旗分 = usubinstr(旗分,"廂","鑲",.) 
replace 旗分 = usubinstr(旗分,"镶","鑲",.)
replace 旗分 = usubinstr(旗分,"红","紅",.)
replace 旗分 = usubinstr(旗分,"蓝","藍",.)
replace 旗分 = usubinstr(旗分,"黃","黄",.)
replace 旗分 = "正藍" if 旗分 == "正藍祺"
replace 旗分 = "鑲白" if 旗分 == "鑲白祺"
replace 旗分 = "不顯" if ustrpos(旗分,"?")
replace 旗分 = "其他" if 旗分 != "" & ustrpos("|不顯|鑲黃|鑲黄|正白|正黃|正黄|正藍|鑲藍|鑲白|鑲紅|正紅|塗黑|","|"+旗分+"|") == 0

旗分_original will contain the original contents of 旗分

  • Instagram
  • Photography website
  • Bluesky
  • LinkedIn

Recent Posts

  • New piece in Guangdong Social Science

    March 29, 2025
  • New article in Explorations in Economic History

    March 21, 2025
  • China Government Employee Dataset-Beiyang (CGED-BY) added to online search

    February 11, 2025
  • Paper in 历史档案 (Historical Archives) by Chen Jun on mid- and low-level Qing military officials

    October 20, 2024
  • Kinship information in the 同年齿录 and related sources completed in August 2024

    August 28, 2024
  • CGED-Q Meeting at Central China Normal University, July 29, 2024-August 2, 2024

    August 6, 2024

Recent Photography

  • HKUST Guangzhou 香港科技大學(廣州)

    March 29, 2025
  • Guozijian and Confucius Temple in Beijing 北京國子監及孔廟

    March 29, 2025
  • Yonghegong in Beijing 北京雍和宮

    March 29, 2025
  • Sunset at Razor Hill, near the HKUST campus 鷓鴣山日落竟

    February 15, 2025
  • Taiwan Province City God Temple 台灣省城隍廟

    February 15, 2025
  • Zhongzheng District in Taipei 臺北中正區

    February 15, 2025
  • A walk from Oban to Dunbeg and back, in the winter

    February 15, 2025

©2025 Cameron D. Campbell 康文林 | Theme by SuperbThemes