Stata tax calculator - Example 1

This example show how to calculate the income tax liability for a sample of taxpayers in 2004 and compare the aggregate value to the taxpayer supplied value.

include taxcalc /* load programs init.ado and comp.ado*/ use /home/data/soi/e/es/puf_2009 gen soiyr = 2004 gen _puf = 1 gen weight = S006/100 init /* initialize tax law parameters */ replace flpdyr = soiyr /* select tax parameters (law year) */ comp /* calculate tax */ keep e10300 c10300 weight format %9.0f e10300 c10300 summarize e10300 c10300 [iw=weight], format /* print aggregate tax after credits*/

Notes

The calculator is supplied as two Stata ado programs: init.ado and comp.ado in a single taxcalc.do file. There are some other macros in that file that will be explained in later examples.

This example shows aggregate "tax after credits" as calculated by the taxpayers and as calculated by taxcalc. E10300 is the element name given by SOI to "tax after credits". Wherever TAXCALC has calculated a value the name used for the claculated value is given the same numeric id, but the "E" is replaced with a "c". A list of input variables is here and calculated values here. _puf is set to 1 to inform that calculator that certain values are in "P" variables rather than "E" variables.

taxcalc.do defines macros for lists of variables as it loads, defines the two .ado programs. and creates a taxcalcparms.dta file in the current directory. This file contains parameter values for tax brackets, tax rates and other thresholds for 1993 on. comp.adowill use these coefficients for calculating liabilities. In this way the correct rates and thresholds will be available for each taxpayer record and can be easily overridden without modifying the supplied code.

comp.ado contains the executable code to calculate the taxpayer liability and numerous intermediate values from the data supplied in the SOI individual tax files. All of these are global variables and any missing input values will be converted to zeroes.

init.ado and comp.ado are separate programs because it may be desirable to run comp.ado several times on the same taxpayer data, such as with various values of tax parameters.

By default the tax is calculated according to the law for the filing period year given by the FLPDYR variable in the data. Here we replace the value of FLPDYR with the SOIYR (the file year) so that late returns are calculated according to the file year. Note that the files at SOI now contain a variable SOIYR for the file year, but the exported files do not as of this writing. So the user must supply it for himself for the time being. Note that the SOIYR variable is a recent addition to the SOI datasets, and may not be available in exported files, in which case you will have to create it yourself.

This exact program will run at OTA, and only the use statement will change for other locations.

The current version of taxcalc.do is 204, and is distributed as taxcalc204.do. The version number is printed in the log file at run time. At OTA a link from taxcalc.do to the latest version should be maintained, but you can use the versioned name if it is important to maintain consistency with earlier work.