Download 42/replication_package/data_replication/psid/code/taxsim.do from chuxuan/REPRO-Bench: direct link, hf CLI and curl.
- Browser
- Download file 7.63 kB
-
https://huggingface.co/datasets/chuxuan/REPRO-Bench/resolve/main/42/replication_package/data_replication/psid/code/taxsim.do
- Command line
-
hf download hf://datasets/chuxuan/REPRO-Bench/42/replication_package/data_replication/psid/code/taxsim.do
-
curl -L -o taxsim.do https://huggingface.co/datasets/chuxuan/REPRO-Bench/resolve/main/42/replication_package/data_replication/psid/code/taxsim.do
7.63 kB
| clear all | |
| set more off | |
| set maxvar 10000 | |
| *Set path | |
| *** | |
| *cd ---- specify path to \data_replication\psid\ | |
| local procdata "./proc_data" | |
| *Define the CPI annual average for each relevant year. | |
| *These are defined for the relevant year of the survey (e.g cpi1999 is for 1998) | |
| local cpi1999 = 163.01 | |
| local cpi2001 = 172.19 | |
| local cpi2003 = 179.87 | |
| local cpi2005 = 188.91 | |
| local cpi2007 = 201.56 | |
| local cpi2009 = 215.25 | |
| local cpi2011 = 218.09 | |
| *Run TAXSIM and compute disposable income | |
| forval x=1999(2)2011{ | |
| di "YEAR `x'" | |
| cd raw_data | |
| *Recode the PSID data | |
| do FAM`x'ER.do | |
| *Construct the variables of interest (income components) | |
| do save_data_`x'.do | |
| ******************** | |
| *Proceed to TAXSIM | |
| ******************** | |
| *Generate tax year (previous year from the survey year) | |
| g year = year_survey - 1 | |
| *Convert PSID state codes to TAXSIM state format | |
| g state = 0 | |
| replace state = 1 if state_residence == 01 /* Alabama */ | |
| replace state = 2 if state_residence == 50 /* Alaska */ | |
| replace state = 3 if state_residence == 02 /* Arizona */ | |
| replace state = 4 if state_residence == 03 /* Arkansas */ | |
| replace state = 5 if state_residence == 04 /* California */ | |
| replace state = 6 if state_residence == 05 /* Colorado */ | |
| replace state = 7 if state_residence == 06 /* Connecticut */ | |
| replace state = 8 if state_residence == 07 /* Delaware */ | |
| replace state = 9 if state_residence == 08 /* DC */ | |
| replace state = 10 if state_residence == 09 /* Florida */ | |
| replace state = 11 if state_residence == 10 /* Georgia */ | |
| replace state = 12 if state_residence == 51 /* Hawaii */ | |
| replace state = 13 if state_residence == 11 /* Idaho */ | |
| replace state = 14 if state_residence == 12 /* Illinois */ | |
| replace state = 15 if state_residence == 13 /* Indiana */ | |
| replace state = 16 if state_residence == 14 /* Iowa */ | |
| replace state = 17 if state_residence == 15 /* Kansas */ | |
| replace state = 18 if state_residence == 16 /* Kentucky */ | |
| replace state = 19 if state_residence == 17 /* Louisiana */ | |
| replace state = 20 if state_residence == 18 /* Maine */ | |
| replace state = 21 if state_residence == 19 /* Maryland */ | |
| replace state = 22 if state_residence == 20 /* Massachusetts */ | |
| replace state = 23 if state_residence == 21 /* Michigan */ | |
| replace state = 24 if state_residence == 22 /* Minnesota */ | |
| replace state = 25 if state_residence == 23 /* Missippi */ | |
| replace state = 26 if state_residence == 24 /* Missouri */ | |
| replace state = 27 if state_residence == 25 /* Montana */ | |
| replace state = 28 if state_residence == 26 /* Nebraska */ | |
| replace state = 29 if state_residence == 27 /* Nevada */ | |
| replace state = 30 if state_residence == 28 /* NewHampshire */ | |
| replace state = 31 if state_residence == 29 /* NewJersey */ | |
| replace state = 32 if state_residence == 30 /* NewMexico */ | |
| replace state = 33 if state_residence == 31 /* NewYork */ | |
| replace state = 34 if state_residence == 32 /* NorthCarolina */ | |
| replace state = 35 if state_residence == 33 /* NorthDakota */ | |
| replace state = 36 if state_residence == 34 /* Ohio */ | |
| replace state = 37 if state_residence == 35 /* Oklahoma */ | |
| replace state = 38 if state_residence == 36 /* Oregon */ | |
| replace state = 39 if state_residence == 37 /* Pennsylvania */ | |
| replace state = 40 if state_residence == 38 /* RhodeIsland */ | |
| replace state = 41 if state_residence == 39 /* SouthCarolina */ | |
| replace state = 42 if state_residence == 40 /* SouthDakota */ | |
| replace state = 43 if state_residence == 41 /* Tennessee */ | |
| replace state = 44 if state_residence == 42 /* Texas */ | |
| replace state = 45 if state_residence == 43 /* Utah */ | |
| replace state = 46 if state_residence == 44 /* Vermont */ | |
| replace state = 47 if state_residence == 45 /* Virginia */ | |
| replace state = 48 if state_residence == 46 /* Washington */ | |
| replace state = 49 if state_residence == 47 /* WestVirginia */ | |
| replace state = 50 if state_residence == 48 /* Wisconsin */ | |
| replace state = 51 if state_residence == 49 /* Wyoming */ | |
| *Marital status: 1 for single, 2 for joint, 3 for head of household. | |
| * Making single if never married, widowed, divorced, separated, or other. | |
| g mstat = cond(marital_status_head != 1, 1, 2) | |
| * Making head of household if unmarried with children. | |
| replace mstat = 3 if mstat == 1 & children > 0 | |
| *Number of dependents (kids) per tax form. | |
| g depx = children | |
| *Labor income of primary and secondary taxpayers | |
| *Includes: | |
| *wages and salaries | |
| *+any separate reports of bonuses | |
| *+overtime | |
| *+tips | |
| *+commissions | |
| *+professional practice or trade | |
| *+market gardening | |
| *+additional job income | |
| *+and miscellaneous labor income | |
| g pwages = labor_inc_head + business_labor_income_head | |
| g swages = (labor_inc_wife+business_labor_income_wife)*(mstat==2) | |
| *g swages = labor_inc_wife*(mstat==2) // only matters if married | |
| *Gross social security benefits | |
| *Taxsim will calculate the portion includable in adjusted gross income (AGI) | |
| g gssi = socsec_income_hh //together wife and head | |
| *Other non-taxable transfer Income such as welfare, workers comp, | |
| *veterans benefits and child support that would affect eligibility for state | |
| *property tax rebates but would not be taxable at the federal level | |
| g transfers = vapension_inc_head + workerscomp_inc_head + tanf_inc_head + /// | |
| otherwelfare_inc_head + childsupport_inc_head + transf_rel_head + /// | |
| ssi_head+ /// | |
| (mstat==2)*(workerscomp_inc_wife + tanf_inc_wife + otherwelfare_inc_wife + /// | |
| childsupport_inc_wife + transf_rel_wife + ssi_wife) | |
| *(mstat==2)*(workerscomp_inc_wife + tanf_inc_wife + otherwelfare_inc_wife + /// | |
| *childsupport_inc_wife + transf_rel_wife + ssi_wife) | |
| *Unemployment compensation benefits | |
| *Taxsim will calculate the portion included in AGI | |
| g ui = unemployment_inc_head + unemployment_inc_wife | |
| *g ui = unemployment_inc_head + (mstat==2)*unemployment_inc_wife | |
| *Number of dependents under age 17 | |
| *Cannot distinguish between children in PSID (asign all children who live in | |
| *Family Unit as dependent) | |
| g depchild = children | |
| *IRA and annuities (benefits and contributions) | |
| *g otherprop=pension_ben-pension_contrib | |
| *Annuities/IRAs head and wife (benefits) | |
| g otherprop=annira_head+pension_wife+business_asset_income_head+business_asset_income_wife | |
| *Taxable retirement income | |
| g pensions = nonva_retir_head+other_pen_head | |
| *Labor income less pension contributions | |
| replace pwages = pwages - stat_pen_contrib_head | |
| replace swages = swages - stat_pen_contrib_wife | |
| *Run taxsim | |
| taxsim9, full replace | |
| di "TAXSIM FOR YEAR `x' OVER" | |
| *Compute total income before tax | |
| gen pretax_income = pwages + swages + transfers + gssi + ui + otherprop + pensions | |
| *Compute disposable income | |
| *Deflate by the CPI (base year 1998) | |
| rename fiitax federalTax | |
| rename siitax stateTax | |
| gen aftertax_income_defl = (pretax_income - federalTax - stateTax)*(`cpi1999' / `cpi`x'') | |
| *Drop HH with negative income (stemming from pension contributions that are too high relative to income or from business losses) | |
| drop if aftertax_income_defl<0 | |
| *Adjust using equivalence scales (OECD) | |
| gen nr_adult = size_fam-depchild | |
| gen equiv = 1.0 + 0.7*(nr_adult-1) + 0.5*depchild | |
| gen aftertax_income_defl_equiv= aftertax_income_defl/equiv | |
| *Drop all unnecessary variables | |
| keep aftertax_income_defl_equiv age_head year_survey ed_head marital_status_head fam_ID_1968 fam_ID_year size_fam equiv state_residence | |
| cd .. | |
| save "`procdata'/temp`x'.dta",replace | |
| } | |