SAS 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 from taxcalc.sas (c10300) to the SOI edited value (E10300).
Notes
The calculator is supplied as two SAS macros: %INIT
and
%COMP
in a single %INCLUDE
file. There are some other
macros in that file that will be explained in later examples.
%INIT
contains the ARRAY
and RETAIN
statements that characterize the tax law. Parameters that change over time are
in arrays indexed by year.
%COMP
contains the executable code to calculate the
taxpayer liability and numerous intermediate values from the data supplied
in the SOI individual tax files. _puf is set to 1 to inform that
calculator that certain values are in "P" variables rather than "E"
variables.
Note that the two macros together do not form a complete data step. They
require introductory data
and set
statements, and allow
for trailing statements also. This allows input or output data to be modified
without adding the I/O and disk space burdens of multiple data steps. It will also
allow changes in tax parameters and multiple calculations of tax without
additional I/O, a feature to used in later examples.
The t.insoleNN files can be either the public use file distributed by SOI, or
the internal file at SOI. The %INCLUDE
file includes some code that
detects the SOI SAS license, and redefines the libname if the code is running at
SOI. For this reason you can modify the libname statement to point to your local
PUF library, and no editing will be required when the job runs at SOI. Naturally
this means that your libname statement must come before the inclusion of
taxcalc.sas
.
The calculator converts any missing input data to zeroes.
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 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.
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.
This exact program will run at SOI, and only the LIBNAME
statement
will change for other locations. The LIBNAME
statemant above is
required to run at NBER, but is overridden by a conditional LIBNAME
statement in the include file when run at SOI. The explicit LIBNAME
statement can be modified to work at your location, without affecting the ability
to run without modification at SOI. OTA uses a slightly different SET statement.
The current version of TAXCALC is 97, and is distributed as
taxcalc97.sas
. The version number is printed in the log file at run
time. At SOI a link from taxcalc.sas
to the latest version should be
maintained, but you can use the versioned name if it is important to maintain
consistency with earlier work.