/******************************************************************************* ******************************************************************************** Program scf_taxsim_main.do This program reads 1989 through 2019 Survey of Consumer Finances (SCF) data sets and produces a multi-year tax units file. The file is then processed using the NBER TAXSIM program (version 32; https://users.nber.org/~taxsim/) which computes and returns estimated tax liabilities. The program draws heavily on a SAS program developed at the Federal Reserve Board by Kevin B. Moore (taxsimpub_taxunits.sas). To run the program, users must install the Stata TAXSIM connection by running: ssc install taxsim32 Note: 1989 and 1992 results are not directly comparable to later years because of changes in survey variables. Although the program processes 1989 and 1992, there are unresolved anomalies because of missing variables in those survey years. The TAXSIM call at the end of the program does not include 1989 and 1992 in this production version of the program. For questions about the program,please contact: Swati Joshi (sjoshi@brookings.edu) John Sabelhaus (jsabelhaus@gmail.com) Development of this Stata program and accopanying documentation was generously supported by a grant from the Peterson Foundation. ******************************************************************************* *******************************************************************************/ clear all set more off,perm do set_file_paths /******************************************************************************* Program Flow 1. Read and save tax parameter and itemized deductions Excel input files. 2. Read and merge SCF core and Bulletin data sets. 3. Implement preemptive data fixes and household variable construction. 4. Construct labor and pension incomes for respondent (R) and spouse (SP). 5. Construct SCF family demographic variables. 6. Construct non-primary economic unit (NPEU) incomes and identify NPEU filers. 7. Initialize measures of possible tax filing dependency. 8. Compute observed itemizable expenses, impute missing expenses. 9. Choose between one or two tax units for respondent (R) and spouse (SP). 10. Add tax unit records to main data set when R, SP do not file jointly. 11. Set initial filing status to single or married in order to split incomes. 12. Construct and allocate incomes across joint, R, and SP tax units (Drop SCF core variables here to save space) 13. Create tax unit records and process incomes for NPEU filers. 14. Compute total income for comparison to IRS tax filing thresholds. 15. Flag filers versus non-filers, drop non-filer records. 16. Allocate dependents and set filing status across all tax units. 17. Compute adjustments to taxable income. 18. Assign itemizable expenses to appropriate tax unit. 19. Choose between standard and itemized deductions. 20. Adjust SCF incomes for disclosure and SOI consistency 21. Construct TAXSIM input dataset. 22. Keep TAXSIM input variables, save input data set 23. Call TAXSIM and merge results back onto TAXSIM input data set. 24. Write merged SCF/TAXSIM results to main results Excel file. *******************************************************************************/ /******************************************************************************* TAXSIM v32 Input Variables and Definitions 1. taxsimid Case ID (arbitrary,but must be a non-negative numeric). 2. year Tax year ending December 31st. 3. state SOI state codes (1 to 51),0=> no state calculation. 4. mstat Marital status (1=single or head of household,2=married filing jointly,6=married filing separately,8=dependent). 5. page Age of primary taxpayer. 6. sage Age of spouse (0 if no spouse). 7. depx Number of dependents (personal exemptions). 8. dep13 Number of children under 13 with eligible child care expenses (Dependent Care Credit). 9. dep17 Number of children under 17 entire tax year (Child Credit). 10. dep18 Number of qualifying children for EITC (under 18 or under 24 and qualifying student). 11. pwages Wage and salary,primary taxpayer (include self-employment but not Qualified Business Income). 12. swages Wage and salary,spouse (include self-employment but not Qualified Business Income). 13. dividends Dividend income (qualified dividends for 2003 and later). 14. intrec Interest received. 15. stcg Short term capital gains or losses (+/-). 16. ltcg Long term capital gains or losses (+/-). 17. otherprop Other property income subvject to NIIT (define NIIT,fill in) 18. nonprop Other non-property income not subject to NIIT (fill in). 19. pensions Taxable pensions and IRA distributions. 20. gssi Gross Social Security benefits. 21. ui Unemployment compensation received. 22. transfers Other non taxable transfer income (welfare,workers compensation,veterans benefits,child support; for state return). 23. rentpaid Rent paid (for state return). 24. proptax Real estate taxes paid (preference for AMT; for state property tax rebates). 25. otheritem Other itemized (other state and local taxes line 8 of Schedule A,local income tax,perference share of medical, miscellaneous on line 27 of Schedule A; preference for AMT) 26. childcare Child care expenses. 27. mortgage Itemized deductions NOT counted in otheritem (#25). Includes Schedule A deductible medical not in line 16, motor vehicle taxes line 7,home mortgage interest line 15, charitable contributions line 19,casulaty or theft losses; line 20). 28. scorp Active S-Corp income (for SSTB,Specialized Service Trade or Business income). 29. pbusinc Primary taxpayer Qualified Business Income (QBI) eligible for preferential rate without phase-out and assuming sufficient wages and capital,subject to SECA and Medicare additional earnings tax. 30. pprofinc Primary taxpayer SSTB eligible for preferential rate subject to clawback,subject to SECA and Medicare additional earnings tax. 31. sbusinc Spouse version of QBI (pbusinc,#29) 32. sprofinc Spouse version of SSTB (pprofinc,#30) *******************************************************************************/ /******************************************************************************* ******************************************************************************** 1. Read and save tax parameter and itemized deductions Excel input files Tax Parameter Definitions syear survey year tyear tax year,usually survey year-1,but could change to use tax laws from different years wyear qualified widower year,usually tyear-2 itdlim1 AGI limit for itemized deductions for single,joint, widower,and head of household filers itdlim2 AGI limit for itemized deductions for married,filing separately filers itdl10 itemized deduction worksheet line 10 divisor expamt personal exemption amount expamt2 personal exemption amount if residual above AGI threshold exdl9 personal exemption worksheet line 9 divisor expagit1 residual AGI threshold for single,joint,widower,and head of household filers expagit2 residual AGI threshold for married,filing separately filers exlim1 AGI limit for exemptions for single filers exlim2 AGI limit for exemptions for joint or widower filers exlim3 AGI limit for exemptions for married,filing separately filers exlim4 AGI limit for exemptions for head of household filers stdamt1 standard deduction amount for single filer or married filing separately,no age exemption stdamt2 standard deduction amount for single filer or married filing separately,one age exemption stdamt3 standard deduction amount for joint filer or widower,no age exemptions stdamt4 standard deduction amount for joint filer or widower,one age exemption stdamt5 standard deduction amount for joint filer,two age exemptions stdamt6 standard deduction amount for head of household filer,no age exemption stdamt7 standard deduction amount for head of household filer,one age exemption filelim1 filing threshold for single filers with no age exemption filelim2 filing threshold for single filers with one age exemption filelim3 filing threshold for joint filers with no age exemption filelim4 filing threshold for joint filers with one age exemption filelim5 filing threshold for joint filers with two age exemptions filelim6 filing threshold for married filing separately filers any age filelim7 filing threshold for head of household filers with no age exemption filelim8 filing threshold for head of household filers with one age exemption filelim9 filing threshold for widower filers with no age exemption filelim10 filing threshold for widower filers with one age exemption lcgagi1 share of capital gains treated as long-term gains for filers with AGI < 50k lclagi1 share of capital losses treated as long-term losses for filers with AGI < 50k lcgagi2 share of capital gains treated as long-term gains for filers with 50k <= AGI < 100k lclagi2 share of capital losses treated as long-term losses for filers with 50k <= AGI < 100k lcgagi3 share of capital gains treated as long-term gains for filers with AGI >= 100k lclagi3 share of capital losses treated as long-term losses for filers with AGI >= 100k paytax payroll tax rate,assuming employee pays both employer and employee share medhi Medicare tax rate ptlim annual payroll tax limit htaxfile flag for including code to merge TAXSIM data into SCF data, set to NO by default,set to YES when you want merge TAXSIM data into the SCF data