49470 1 1 1 255 0 2 269 1 54470 1 0 1 222 1 56470 1 1 1 231 1 2 231 1 58470 1 0 1 217 1 59470 1 0 1 243 1 2 222 1 3 224 1 60470 1 1 1 250 1 2 211 1 61470 1 0 1 217 0 2 240 0 3 226 1 62470 1 1 1 258 1 2 260 0 63470 1 0 1 247 1 64470 1 0 1 245 1 2 248 0 65470 1 1 1 263 0 2 249 0 END hier.raw CUT HERE 46
复制Dehejia-Wahba (1999)表1
*!Xiliang ZHAO 2014/12/17 cap log close
log using dw.smcl, replace set more off
/*First, we append all the data set into one, nswt.dta*/ use nsw, clear append using nsw_dw
local datafile \foreach data of local datafile { }
47
append using `data' forv i = 2/3 { }
append using `data'`i'
encode data_id, g(data) save nswt,replace
/*reproduce table 1 in DW(1999), see table1.rtf, we find that the standard deviations are different from DW(1999), we donot know why.*/
local vlist \local vlist2 \
*Lalonde original NSW data use nswt,clear preserve keep if data==5
estpost tabstat `vlist',by(treat) statistics(n mean sd) columns(statistics) listwise nototal eststo lalonde restore
*Dehejia-Wahba NSW subsample preserve keep if data==4
estpost tabstat `vlist2',by(treat) statistics(n mean sd) columns(statistics) listwise nototal eststo dw restore *PSID1
48
preserve keep if data==6
estpost tabstat `vlist2' ,by(treat) statistics(n mean sd) columns(statistics) listwise nototal eststo psid1 restore *PSID2 preserve keep if data==7
estpost tabstat `vlist2',by(treat) statistics(n mean sd) columns(statistics) listwise nototal eststo psid2 restore *PSID3 preserve keep if data==8
estpost tabstat `vlist2',by(treat) statistics(n mean sd) columns(statistics) listwise nototal eststo psid3 restore *CPS1 preserve keep if data==1
estpost tabstat `vlist2' ,by(treat) statistics(n mean sd) columns(statistics) listwise nototal eststo cps1 restore *CPS2 preserve keep if data==2
49
estpost tabstat `vlist2' ,by(treat) statistics(n mean sd) columns(statistics) listwise nototal eststo cps2 restore *CPS3 preserve keep if data==3
estpost tabstat `vlist2' ,by(treat) statistics(n mean sd) columns(statistics) listwise nototal eststo cps3 restore
esttab lalonde dw psid1 psid2 psid3 cps1 cps2 cps3 using table1.rtf, main(mean) aux(sd) nostar unstack log close set more on exit
下面我们用一个例子来说明数据处理问题 中国居民收入调查(CHIP)例子
set more off version 11.1
*use \Data.dta\
use 21741-0003-Data.dta, clear //在当前目录直接打开 *Transform all variables into lower case
50