Download 105/replication_package/make_Table_4.do from chuxuan/REPRO-Bench: direct link, hf CLI and curl.
- Browser
- Download file 2.45 kB
-
https://huggingface.co/datasets/chuxuan/REPRO-Bench/resolve/main/105/replication_package/make_Table_4.do
- Command line
-
hf download hf://datasets/chuxuan/REPRO-Bench/105/replication_package/make_Table_4.do
-
curl -L -o make_Table_4.do https://huggingface.co/datasets/chuxuan/REPRO-Bench/resolve/main/105/replication_package/make_Table_4.do
2.45 kB
| ****************************************************************************************** | |
| * Replicate Table 4 of "Safe Assets" by Barro, Fernandez-Villaverde, Levintal and Mollerus | |
| ****************************************************************************************** | |
| clear all | |
| clear mata | |
| set mem 500m | |
| set maxvar 32767 | |
| set more off | |
| cap log close | |
| clear | |
| use rscfp2019 // can be downloaded from https://www.federalreserve.gov/econres/files/scfp2019s.zip | |
| gen stockfund = stmutf | |
| gen stocks_indirect = equity - stocks - stockfund /* the variable equity is generated by SCF to measure all stock holdings, including indirect holdings of stocks. */ | |
| gen realestate_net = houses - mrthel + oresre - resdbt +nnresre | |
| gen otherphysical = vehic + othnfin | |
| gen allequity = equity + bus | |
| * percentiles | |
| _pctile networth [aweight = wgt], p(50,75,90,95,99) | |
| local p50 = r(r1) | |
| local p75 = r(r2) | |
| local p90 = r(r3) | |
| local p95 = r(r4) | |
| local p99 = r(r5) | |
| gen pctile = 0 | |
| replace pctile = 1 if networth<=`p50' | |
| replace pctile = 2 if networth>`p50' & networth<=`p75' | |
| replace pctile = 3 if networth>`p75' & networth<=`p90' | |
| replace pctile = 4 if networth>`p90' & networth<=`p95' | |
| replace pctile = 5 if networth>`p95' & networth<=`p99' | |
| replace pctile = 6 if networth>`p99' | |
| foreach var in "networth" "allequity" "stocks" "stockfund" "bus" "stocks_indirect" "realestate_net" "othnfin" "vehic" { | |
| di "`var'" | |
| gen sum_`var' = 0 | |
| gen share_`var' = 0 | |
| gen port_`var' = 0 | |
| foreach x in 1 2 3 4 5 6 { | |
| sum `var' [aweight = wgt] if pctile==`x' | |
| replace sum_`var' = r(sum) if _n==`x' | |
| } | |
| * total population | |
| sum `var' [aweight = wgt] | |
| replace sum_`var' = r(sum) if _n==7 | |
| * bottom 90 | |
| sum `var' [aweight = wgt] if pctile<=3 | |
| replace sum_`var' = r(sum) if _n==8 | |
| * p90-p95 | |
| sum `var' [aweight = wgt] if pctile==4 | |
| replace sum_`var' = r(sum) if _n==9 | |
| * top 5 | |
| sum `var' [aweight = wgt] if pctile>=5 | |
| replace sum_`var' = r(sum) if _n==10 | |
| * top 1 | |
| sum `var' [aweight = wgt] if pctile==6 | |
| replace sum_`var' = r(sum) if _n==11 | |
| * share in total population | |
| replace share_`var' = sum_`var'/sum_`var'[7] | |
| } | |
| keep share* | |
| keep if _n<=11 | |
| quietly log using Tables_1_to_4.smcl, append | |
| * Table 4 (transposed) | |
| list share_networth share_allequity share_stocks share_stockfund share_bus share_stocks_indirect share_realestate_net share_othnfin share_vehic if _n>=8, clean noobs | |
| log close | |