use dataset_B,clear
sort province
g provid = province //多生成一個(gè)表示省份的數(shù)值型變量
preserve
outsheet province provid using province.txt, replace noquote //導(dǎo)出省份名稱(chēng)文本到txt
insheet using province.txt, clear //將之導(dǎo)入Stata
rename province prov //重命名為prov
save province, replace //保存,下一步將它merge給dataset_B
restore
merge m:1 provid using province, nogen //merge給dataset_B
erase province.dta //刪除臨時(shí)文件