code to do percentile wealth inequality calculations on SCF data.
**5/24/2014: Piketty and SCF
foreach num of numlist 1992 1995 1998 2001 2004 2007 2010{
cd $scf
use rscfp`num’, clear
sort YY1
by YY1: keep if _n==1
xtile t1=networth [aw=wgt], nq(5)
foreach x of numlist 1/5{
gen networth`x’=networth if t1==`x’
gen networthhom`x’=homeeq if t1==`x’
gen networthnhm`x’=(networth-homeeq) if t1==`x’
}
collapse (mean) networth? networthhom? networthnhm? [aw=wgt]
gen year=`num’
cd $datapath
save t`num’, replace
clear
}
foreach num of numlist 1992 1995 1998 2001 2004 2007 2010{
append using t`num’
erase t`num’.dta
}
foreach y in networth networthhom networthnhm{
gen `y’rat=`y’5/`y’3
}
*graphs
# delimit ;
graph twoway line networthrat year,
scheme(s1mono) title(“Ratio of richest 20% to middle 20%” “Total wealth”)
xtitle(“”) ytitle(“”) lc(maroon) lw(thick)
xlabel(1992 1995 1998 2001 2004 2007 2010) lw(thick)
caption(
“houseofdebt.org, @AtifRMian & @profsufi, Data source: SCF”,
size(vsmall)
) xsize(4.25) ysize(3);
# delimit cr
graph export “$output\houseofdebt_20140524_1.png”, replace
# delimit ;
graph twoway line networthnhmrat year,
scheme(s1mono) title(“Ratio of richest 20% to middle 20%” “Non-home equity wealth”)
xtitle(“”) ytitle(“”) lc(navy) lw(thick)
xlabel(1992 1995 1998 2001 2004 2007 2010) lw(thick)
caption(
“houseofdebt.org, @AtifRMian & @profsufi, Data source: SCF”,
size(vsmall)
) xsize(4.25) ysize(3);
# delimit cr
graph export “$output\houseofdebt_20140524_2.png”, replace
# delimit ;
graph twoway line networthhomrat year,
scheme(s1mono) title(“Ratio of richest 20% to middle 20%” “Home equity wealth”)
xtitle(“”) ytitle(“”) lc(dkgreen) lw(thick)
xlabel(1992 1995 1998 2001 2004 2007 2010) lw(thick)
caption(
“houseofdebt.org, @AtifRMian & @profsufi, Data source: SCF”,
size(vsmall)
) xsize(4.25) ysize(3);
# delimit cr
graph export “$output\houseofdebt_20140524_3.png”, replace