// Copyrights belong to @计量经济圈
**For Econometrics Circle, 以下只是例子而已
use econometrics.dta, clear //输入数据
// Data management
global m F3A F4A A1 C18AA C18AB C18AC C18AD C18AE C18AF E8A B3A F6A //定义全局宏
**一个简单的循环来把变量的label全部删除
foreach varlist of global m {
label variable `varlist' ""
}
**数据整理基本要素
qui {
recode F3A (1=0)(3=1)(2=2)(else=.), gen(z)
label var z "wich one has higher z"
label define z 0 "a" 1 "b" 2 "c"
label values z
recode F4A (0=0)(1=1)(2=2)(3=3)(4=4)(5=5)(6=6)(7=7)(8=8)(10=10)(else=.), gen(number_child)
label var number_child "number of children"
recode A1 (1=0)(2=1)(else=.), gen(gender)
label var gender "if female"
gen Income = C18AA + C18AB + C18AC + C18AD + C18AE + C18AF
gen Inc = Income if inrange(Income,0,1000000)
label var Inc "total income"
capture drop Lninc
gen Lninc = ln(Inc+1)
gen income=Lninc
recode E8A (3=1) (1=0) (else=.), gen(x)
label var x "if x"
gen age2 = age^2
recode B3A (1=1) (2=2) (3=3) (4/5=4)