PSLmodels / Tax-Calculator

USA Federal Individual Income and Payroll Tax Microsimulation Model
https://taxcalc.pslmodels.org
Other
263 stars 157 forks source link

Status of e32750 and e32800 in Tax-Calculator #675

Closed martinholmer closed 8 years ago

martinholmer commented 8 years ago

I'm confused about the relationship between e32750 and e32800 in Tax-Calculator.

In order to pass the Internet-TAXSIM validation tests, the SimpleTaxIO class has to set both of them equal to qualified child/dependent-care expenses --- see Internet-TAXSIM input variable 17 and SimpleTaxIO code.

But yet the e_var_info.csv documentation file says that e32750 is not contained in the puf.csv file, while e32800 is.

What exactly is the difference between these two variables?

@Amy-Xu @MattHJensen @feenberg

Amy-Xu commented 8 years ago

It seems to me, according to the line number provided in e_var_info.csv and form 2441, e32800 is the total expense of all dependents with each dependent's expense capped at $3000, while e32750 is the original qualified expense for one dependent. Only the total --- e32800 --- is available in PUF.

martinholmer commented 8 years ago

@Amy-Xu said:

It seems to me, according to the line number provided in e_var_info.csv and form 2441, e32800 is the total expense of all dependents with each dependent's expense capped at $3000, while e32750 is the original qualified expense for one dependent. Only the total --- e32800 --- is available in PUF.

Amy, Thanks for the clarification. But now I have a different question. I just confirmed that the Internet-TAXSIM validation tests (using the c13, c14, and c15 samples) all PASS when e32750 is set equal to child-care expenses and e32800 is zero, but all FAIL when e32800 is set equal to child-care expenses and e32750 is zero (which is the case when Tax-Calculator is using puf.csv as input). So, unless I'm confused, this suggests that (a) Internet-TAXSIM Form 2441 logic is incorrect or (b) Tax-Calculator Form 2441 logic is incorrect or (c) both models have problems with the Form 2441 logic.

Since we don't have access to the Internet-TAXSIM code, it would seem that we should check by hand calculations the Tax-Calculator logic regarding Form 2441 tax credit calculations. Because if Internet-TAXSIM is correct, then it would appear as if there is a (logic or data) flaw in Tax-Calculator.

@MattHJensen @Amy-Xu @feenberg @GoFroggyRun

GoFroggyRun commented 8 years ago

I briefly took a look at the tax logic for e32800 in SAS calculator (most recent update) and tax calculator. It seems that, in SAS, we have:

if f2441 gt 0 then do;
  if FLPDYR ge 2004 then do;
    if MARS eq 2 then
      _secwage = min(c32880,c32890,min(e33420 + e33430 - e33450,e33460));
    else
      _secwage = min(c32880,min(e33420 + e33430 - e33450,e33460));

    c33465 = e33465;
    c33470 = e33470;
    c33475 = max(0,min(_secwage,5000/_sep) - c33470);
    c33480 = max(0,e33420 + e33430 - e33450 - c33465 - c33475);
    c32840 = c33470 + c33475;
    c32800 = min(max(0,_dclim-c32840),_ccexp);
  end;
  else do;
    c32840 = min(min(min(e33420-e33450,e33460),c32880,c32890),5000/_sep);
    c33480 = e33420 - e33450 - c32840;
    c32800 = min(max(0,_dclim-c32840),max(0,max(0,_ccexp,e32700)-c32840));
  end;
  if _pufmake or _puf then c32800 = e32800;
end;

so that c32800 is always equal to e32800, which is not the case in Tax calculator. Not sure if this explains the inconsistency against TAXSIM or not.

@martinholmer , could you post the diff file and/or some records with significant tax liability difference?

feenberg commented 8 years ago

On Mon, 4 Apr 2016, Martin Holmer wrote:

I'm confused about the relationship between e32750 and e32800 in Tax-Calculator.

This had us confused untill late in March.

In order to pass the Internet-TAXSIM validation tests, the SimpleTaxIO class has to set both of them equal to qualified child/dependent-care expenses --- see Internet-TAXSIM input variable 17 and SimpleTaxIO code.

We should not be using E32750 or E32775 at all. We should use E32700 for child care expenses.

But yet the e_var_info.csv documentation file says that e32750 is not contained in the puf.csv file, while e32800 is.

I don't know about that.

What exactly is the difference between these two variables?

E32750 is the expense for the first child. E32800 is the amount paid by the taxpayer (not by the employer) and after the limitation to $3,000 or $6,000.

dan

@Amy-Xu @MattHJensen @feenberg

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub[AHvQVbCk-aAfAsmkELBzXQYOPsiB2vr8ks5p0SD_gaJpZM4H_J-a.gif]

feenberg commented 8 years ago

On Mon, 4 Apr 2016, Martin Holmer wrote:

@Amy-Xu said:

  It seems to me, according to the line number provided in e_var_info.csv and form
  2441, e32800 is the total expense of all dependents with each dependent's expense
  capped at $3000, while e32750 is the original qualified expense for one
  dependent. Only the total --- e32800 --- is available in PUF.

Amy, Thanks for the clarification. But now I have a different question. I just confirmed that the Internet-TAXSIM validation tests (using the c13, c14, and c15 samples) all PASS when e32750 is set equal to child-care expenses and e32800 is zero, but all FAIL when e32800 is set equal to child-care expenses and e32750 is zero (which is the case when Tax-Calculator is using puf.csv as input). So, unless I'm confused, this suggests that (a) Internet-TAXSIM Form 2441 logic is incorrect or (b) Tax-Calculator Form 2441 logic is incorrect or (c) both models have problems with the Form 2441 logic.

E32750 and E32775 should not be used. They do not add up to E32700, which should be used.

dan

Since we don't have access to the Internet-TAXSIM code, it would seem that we should check by hand calculations the Tax-Calculator logic regarding Form 2441 tax credit calculations. Because if Internet-TAXSIM is correct, then it would appear as if there is a (logic or data) flaw in Tax-Calculator.

@MattHJensen @Amy-Xu @feenberg @GoFroggyRun

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub[AHvQVW284N1zqrsYhgw7Otiv1W0i2L2Xks5p0SrrgaJpZM4H_J-a.gif]

martinholmer commented 8 years ago

Sean said:

Martin, could you post the diff file and/or some records with significant tax liability difference?

When I use the c13.in file to compare Tax-Calculator results with Internet-TAXSIM results and use the code on the master branch, we get no income tax liability differences (greater than one cent).

But when I conduct the exact same test using SimpleTaxIO code that sets e32800 to expenses and leaves e32750 equal to zero (which is what is happening with puf.csv input in TaxBrain), I get 14,984 filing units (out of the 100,000 in the c13.in file) with income tax differences (greater than one cent). The filing unit with the largest difference has an id of 29224: that unit's tax liability in Tax-Calculator is $1235 larger than in Internet-TAXSIM because the child-care-expense credit is $1235 less than in Internet-TAXSIM.

Here is the Internet-TAXSIM input record for id=29224:

$ awk '$1==29224' c13.in
29224 2013 0 3 2 0 29000 0 2000 0 0 0 0 0 3600 400 9000 2000 2 0 3000 -1000
$ 

@GoFroggyRun @MattHJensen @feenberg @Amy-Xu

martinholmer commented 8 years ago

Dan said:

E32750 and E32775 should not be used. They do not add up to E32700, which should be used.

I don't see E32700 anywhere in the Tax-Calculator code or in the e_variable_info.csv documentation file. Is E32700 in the IRS-SOI 2009 PUF?

@feenberg @Amy-Xu @MattHJensen @GoFroggyRun

GoFroggyRun commented 8 years ago

@martinholmer :

While I'm looking into this issue, it occurs to me that TAXSIM assumes e32750 = e32800 = ivar[17]. So that, in the case where we set e32750 to zero, there's no way to for us to get updated outputs on TAXSIM end. Is that right? So, we are really assuming that the output won't change for TAXSIM as well when e32750 were set to zero?

martinholmer commented 8 years ago

Sean said:

So, we are really assuming that the output won't change for Internet-TAXSIM when e32750 is set to zero in Tax-Calculator?

That is correct. We have no control over what Internet-TAXSIM does with its inputs.

@GoFroggyRun @feenberg @MattHJensen @Amy-Xu

feenberg commented 8 years ago

I have attached the latest version of taxcalc.sas. It has a minor revision to the form 2441 calculation, involving the 3000/6000 limitation. I do not believe it is relevant to the present discussion, but shoudl be tried.

As to the difference with internet taxsim, could one of you give me the 22 variables for one of the problem records and let me check out what internet taxsim does? I'd like to assure myself that it is right. Perhaps it isn't?

Thanks dan

/*

Taxcalc.sas is a calculator for the US Federal Income Tax

It was written by Inna Shapiro (NBER) and Daniel Feenberg (NBER) with help from Micahel Strudler and Victoria Bryant of SOI. Users are asked to please correspond with feenberg@nber.org after visiting the taxcalc website at

http://www.nber.org/taxcalc

Insole File Infelicities: e11400 changes from unknown F6251 in 1998-2000 is only state income tax refund on 6251, not all 6251 Some taxpayers itemize on 6251 but not schedule A. e07980 is used for electric vehicle and ny liberty zone e07970 is used for rate reduction credit and electric vehicle credit n11 is used for number of children and number of countries e73900, e35210* and e35220* are used for non-dollar amounts t35200 and t35300 seem to be the same concept t35905 changes concept from income exclusion to sum of that and housing deduction schj and schjin mean the same thing? e03200 is jury duty pay deduction 2006 but primary IRA in 1994-1996 e09700 (recapture tax) is missing from datasets e87662 is 1000 times fraction documented advance rate reduction credit is not available advance child tax credit is not available e20200 combines cash and asset giving n11 electronic filing indicater through 2000 then katrina flag Need parents filing status and capital gains for kiddie tax In 2003 we don't know if gain is post May 6 don't have husband and wives wages for f2555 EITC Asset income test seems to be ignored by editor Even if needed for Form 6251, Schedule D worksheet is not calculated when Taxable Income is zero and Schedule A is zeroed out, if taxpyer uses standard deduction. sname and cade_cycle change variable type */

%MACRO _NOTICE; %PUT NOTE: TAXCALC version 204 (c) 2013-2016 National Bureau of Economic Research; %PUT NOTE: Documentation at http://www.nber.org/taxcalc; %MEND _NOTICE; %_NOTICE;

%MACRO COMP;

If not (1993<=FLPDYR<=2015) then do; put "TAXCALC ER" "ROR: flpdyr out of range for taxcalc: " flpdyr= RECID= n=; flpdyr=SOIYR; end;

/* Form 2555 */

_feided = e02700; c02700 = min(_feided,_feimax{flpdyr}_F2555__txp);

/* Earned income and FICA */

if e09400 gt .153__ssmax{flpdyr} then _sey = (e09400 - .124_ssmax{flpdyr})/(.029.9235); else sey = e09400/(.153.9235);

_sey9235 = max(0,.9235*_sey);

if _sey9235 lt 400 then c09400 = 0; else if _sey9235 le _ssmax{flpdyr} then c09400 = .153sey9235; else c09400 = .124ssmax{flpdyr} + .029*_sey9235;

/* Adjustments */

c03260 = .5*c09400;

if flpdyr in(2011,2012) then do; if e09400 gt .133__ssmax{flpdyr} then _sey = (e09400 - .104_ssmax{flpdyr})/(.029.9235); else sey = e09400/(.133.9235);

_sey9235 = max(0,.9235__sey); if _sey9235 lt 400 then c09400 = 0; else if _sey9235 le _ssmax{flpdyr} then c09400 = .133sey9235; else c09400 = .104ssmax{flpdyr} + .029__sey9235;

c02900 = e03150 + e03210 + e03600 + c03260 + e03270 + e03300

if flpdyr ge 2002 then c02900 = c02900 + e03220 + e03230; if flpdyr ge 2005 then c02900 = c02900 + e03240; if flpdyr ge 2004 then c02900 = c02900 + e03290;

/* Capital Gains */

c23650 = e23250 + e22250; if flpdyr ge 1994 then c23650 = c23650 + e23660; c01000 = max(-3000/_sep,c23650);

/* _ymod is income less adjustments plus half of SS benefits */

_ymod1 = e00200 + e00300 + e00600 + e00700 + e00800 + e00900

/* Taxation of Social Security Benefits*/

if recid eq 308101 and flpdyr eq 2011 then put recid= flpdyr= ssind= e02500= _ymod=; if pufmake or SSIND gt 0 or MARS in(3,6) then /* Can't calculate these w/o more info / c02500 = e02500; else if _ymod lt _ssb50(MARS) then c02500 = 0; else if flpdyr eq 1993 or (_ymod ge _ssb50(MARS) and _ymod lt _ssb85(MARS)) then c02500 = .5_min(_ymod-ssb50(MARS),e02400); else c02500 = min(.85(_ymod-_ssb85(MARS))

/* Gross Income */

c02650 = _ymod1 + c02500 - c02700; if flpdyr ge 2010 then c02650 = c02650 + e02615;

/* AGI */

c00100 = c02650 - c02900;

_posagi = max(c00100,0);

/* Personal Exemptions */

if dsi then _xtot = 0; else if _puf or xtot eq . then _xtot = sum(1,XOCAH,XOCAWH,XOODEP,XOPAR,mars eq 2); else _xtot = xtot;

_prexmp = _xtot__amex{flpdyr}; _katxmp = 0; if (2005<=FLPDYR<=2009) and _katrina then _katxmp = min(sum(0,n11)_500,2000); _prexmp = _prexmp + _katxmp; if _round then do _ratio = (_posagi - _exmpb{flpdyr,MARS})/(2500/_sep); _tratio = CEIL(_ratio); _dispc = min(1,max(0,.02__tratio)); end; else do; dispc = min(1,max(0,.02(_posagi-_exmpb{flpdyr,MARS})/(2500/_sep))); end;

if flpdyr in(2006,2007) then _dispc = (2./3.)__dispc; if flpdyr in(2008,2009) then _dispc = (1./3.)__dispc; if flpdyr in(2010:2012) then _dispc = 0;

c04600 = prexmp(1-_dispc);
_dispc = _dispc_1000;

/* Additional Medicare Tax .9% on earned income / if flpdyr ge 2013 then do; c09730 = .009(max(0,e00200+x85330-_thresx{MARS}) + max(0,_sey-max(0,_thresx{MARS}-e00200))); if _medfix eq 1 then c09730 = e09730; end;

if flpdyr GE 2004 then c11055 = e11055; else c11055 = 0; _earned = max(0,e00200 + e00250 + c11055 + e30100 + _sey - c03260);

/* Itemized Deductions */

/* Medical */

if flpdyr le 2012 or _agep ge 65 or _ages ge 65 gt 0 then
c17750 = .075posagi; else c17750 = .100posagi;

/* Ref:http://www.irs.gov/publications/p501/ar02.html#en_US_2014_publink1000220868 This is minor and not completely correct */ c17000 = max(0,e17500-c17750);

if flpdyr ge 2004 then c18400 = max(e18450,max(e18400,e18425,0)); else c18400 = max(e18400,e18425,0);

/* Other Taxes */

c18300 = c18400 + e18500 + e18800 + e18900;
if flpdyr in(2009,2010) and c18400 ge e18450 then c18300 = c18300 + e18600;

/* Casulty */

c20500 = max(0,c37703-.1*_posagi);
if _puf then c20500 = e20500;

/* Interest paid and Misc */

c20750 = .02*_posagi;
if _puf or _pufmake then do; c20400 = e20400; c19200 = e19200; end; else do; c20400 = e20550 + e20600 + e20950; c19200 = e19500 + e19530 + e19570 + e19400 + e19550; end; c20800 = max(0.,c20400-c20750);

/* Charity (Assumes carryover is non-cash) */

if _exact or _pufmake then do; c19700=e19700; end; else if _puf then do; _lim30 = min(.3posagi,e20100 + x20200);
c19700 = min(.5
posagi,_lim30 + e19800); end; else do; _lim30 = min(.3posagi,e20100 + e20200);
c19700 = min(.5
posagi,_lim30 + e19800); end;

/* Gross Itemized Deductions */

c21060 = e20900 + c17000 + c18300 + c19200

if flpdyr le 1994 then c21060 = c21060 + e20300;

/* Itemized Deduction Limitation */

c04470 = c21060 ;

if flpdyr lt 2013 then _phase2 = _phase{flpdyr}/_sep; else _phase2 = _exmpb{flpdyr,MARS};

_itemlimit=1; _nonlim = c17000 + c20500 + e19570 + e21010 + e20900; _limitratio = _phase2; if c21060 gt _nonlim and flpdyr ge 1991 and c00100 gt _phase2 then do; _itemlimit=2; dedmin = .8(c21060-_nonlim); _dedpho = .03_max(0,_posagi-_phase2); c21040 = min(_dedmin,_dedpho); if flpdyr in(2006,2007) then c21040 = (2/3)_c21040; if flpdyr in(2008,2009) then c21040 = (1/3)_c21040; if flpdyr in(2010:2012) then c21040 = 0; c04470 = c21060 - c21040;
end; else do; c21040 = 0; end;

if _pufmake then c04470 = max(e04470,p04470);

/Standard Deduction with Aged, Sched L and Real Estate/

if DSI eq 1 then do; c15100 = max(_earned+_stddsi(flpdyr),_stded(flpdyr,7)); c04100 = min(_stded{flpdyr,MARS},c15100); end;

else do; if MIDR then c04100 = 0; else c04100 = _stded{flpdyr,MARS}; end;

if flpdyr ge 2009 then c04100 = c04100 + e15360; if _pufmake then c04100 = e04100; if flpdyr eq 2008 or flpdyr eq 2009 then do; c04250 = min(max(e18500,e04250),_txp*500); if _pufmake then c04250 = e04250; c15250 = c04250; end; else c04250 = 0;

c04200 = _numxtr*_aged(_txpyrs,flpdyr); if _pufmake or (_exact and (MARS eq 3 or MARS eq 5)) then c04200 = e04200;

c15200 = c04200; _stndrd = c04100 + c04200; if flpdyr in(2008:2010) then _stndrd = _stndrd + c04250 + e37717; /if flpdyr in(2009,2010) then _stndrd = _stndrd + e15210; else _stndrd = _stndrd + e37717; / if (MARS eq 3 or MARS eq 6) and midr eq 1 then _stndrd = 0; if flpdyr in(2009,2010) then c04500 = c00100 - max((c21060-c21040),c04100,_stndrd); else c04500 = c00100 - max((c21060-c21040),_stndrd);

c04800 = max(0,c00100-max(_stndrd,c04470)-c04600-e04805);

/Some taxpayers itemize only for AMT, not regular tax / if flpdyr le 2002 then _amtstd = _stndrd; else _amtstd = 0;

_taxinc = c04800; _feitax = 0; if flpdyr ge 2006 and _feided gt 0 then do; _taxinc = c04800 + _feided; %taxer(_feided,_feitax,MARS); end;

/* Tax calculated with X, Y or Z and Schedule D*/

%TAXER(_taxinc,_xyztax,MARS); %TAXER(c04800,c05200,MARS); *c24516 = max(0,min(e23250,c23650)) + e01100; c24580 = _xyztax;

/* Tax on non-gain income */

_cglong = min(c23650,e23250) + e01100;

if _taxinc gt _brk3{flpdyr,MARS} and flpdyr in(1993:1996) and _cglong gt 0 then do; _noncg = max(_brk2{flpdyr,MARS},_taxinc - (_cglong - e58990)); %TAXER(_noncg,c06300,MARS); _taxltg = .28(_taxinc - _noncg); Tax on cg TI; c24580 = min(_taxltg + c06300,_xyztax); end; else do; _noncg = 0; c06300 = 0; end;

/* Tax with gains */ c24515=0; c24517=0; c24520=0; c24530=0; c24532=0; c24533=0; c24540=0; c24581=0; _dwks16=0;;

_hascg = (e23250 gt 0 and c23650 gt 0) or e00650 gt 0 or e01100 gt 0; _if _hascg eq 0 then goto nocg; if (1997<=FLPDYR<=2002) & hascg then do; c24510 = max(0,min(c23650,e23250)+e01100); / schD gain for tax comp / c24516 = max(0,c24510 - e58990); / gain less invest income _/ _dwks6 = max(0,min(e22250+e22550 ,e22550)); _dwks8 = dwks6 + e24515; / unrecaptured 1250 gain _/ c24517 = max(0,c24516 - dwks8); / gain less 25% income / c24520 = max(0,c04800 - c24517); / tent TI less schD gain _/ c24530 = min(_brk2(flpdyr,MARS),_taxinc); /min TI for bracket/ _dwks12 = min(c24520,c24530); _dwks13 = max(0,_taxinc - c24516); c24540 = max(_dwks12,dwks13); %TAXER(c24540,c24560,MARS); / e24560 non-SchD Tax _/ _dwks16 = c24530 - _dwks12; c24581 = _dwks16; if flpdyr in(2001,2002) then do; _dwks17 = e24583; c24585 = max(0,min(c24581,dwks17)); c24587 = .08 * c24585; / SchD 8% Tax Amount _/ c24590 = c24581 - c24585; end; * 2001:2002; if flpdyr le 2000 then c24590 = c24530 - dwks12; c24595 = .1 * c24590; / SchD 10% Tax Amount _/ _dwks22 = min(_taxinc,c24517); if flpdyr ge 2001 then c24600 = dwks22 - c24581; / 20% SchD gains */ else c24600 = _dwks22 - c24590;

 c24605 = .20 * c24600;                   /* Tax on 20% gains */
 _dwks26 = min(c24516,e24515);
 _dwks27 = c24516 + c24540;
 _dwks29 = max(0,_dwks27-_taxinc);
 c24610 = max(0,_dwks26-_dwks29);         /* 25% SchD gains */
 c24615 = .25 * c24610;                   /* Tax on 25% gains */

 if flpdyr ge 2001 then                   /* SchD 28% income */
    c24550 = _taxinc - (c24540 + c24581 + c24600 + c24610);
 if flpdyr le 2000 then                 
    c24550 = _taxinc - (c24540 + c24590 +c24600 + c24610);
 c24570 = .28 * c24550;                   /* SchD 28% Tax */

 _taxcg = c24595 + c24605 + c24615 + c24570 +c24560;
 if flpdyr ge 2001 then _taxcg = c24587 + _taxcg;
 c24580 = min(_taxcg,_xyztax);      /* SchD tax  */

end; * 1997:2002;

c24532 = 0;

if flpdyr ge 2003 then do; _dwks5 = max(0,e58990-e58980); c24505 = max(0,c00650 - dwks5); c24510 = max(0,min(c23650,e23250)) + e01100; /* gain for tax computation / if pufmake then c24510 = e24510; if e01100 gt 0 then c24510 = e01100; / from app f 2008 drf _/ dwks9 = max(0,c24510-min(e58990,e58980));/ e24516 gain less invest y _/ c24516 = c24505 + _dwks9; if _pufmake then c24516 = e24516; _dwks12 = min(_dwks9,e24515+e24518); c24517 = c24516 - dwks12; / gain less 25% and 28% _/ if _pufmake then c24517 = e24517; c24520 = max(0,taxinc - c24517); / tentative TI less schD gain _/ if _pufmake then c24520 = e24520; c24530 = min(_brk2(flpdyr,MARS),taxinc); / minimum TIfor bracket _/ if _pufmake then c24530 = e24530; _dwks16 = min(c24520,c24530); _dwks17 = max(0,_taxinc - c24516); c24540 = max(_dwks16,_dwks17); if _pufmake and _feided eq 0 then c24540 = e24540; if flpdyr eq 2003 then do; c24532 = c24530 - dwks16; / 5% limitation amount / c22256 = -min(0,e21606+e21626+e21776);/ net STL (5/5/03)/ c22556 = e22306+e22326+e22366+e22376; / LTG or loss (5/5/03) / c23656 = max(0,-c22256 + c22556); / net cg before exclusion/loss limit (5/5/03) / c24533 = c23656 + c24505; / qualifying dividend and schD gain (5/5/03) / c24534 = min(c24532,c24533); / income subject to 5% tax / if _pufmake then c24534 = e24534; end; \ 2003;

if flpdyr ge 2004 then c24534 = c24530 - _dwks16; if flpdyr lt 2008 then c24535 = .05 * c24534; else c24535 = 0; /e24535 Schedule D 5% Tax /;

c24605 = 0; if flpdyr eq 2003 then do; c24581 = c24532 - c24534; c24585 = min(c24581,e24583); /* income subject to 8% tax / c24587 = .08 * c24585; / 8% Tax / c24590 = c24581 - c24585; / income subject to 10% tax / c24595 = .1 * c24590; / 10% Tax _/ _dwks29 = min(_taxinc,c24517); _dwks31 = max(0,_dwks29-c24532); _dwks34 = c24533 - c24534; c24597 = min(_dwks31,dwks34); / income subject to 15% tax / c24598 = .15 * c24597; / 15% Tax Amount _/ c24600 = dwks31 - c24597; / income subject to 20% tax / c24605 = .2 * c24600; / 20% Tax _/ _dwks39 = min(c24516,e24515); _dwks40 = c24516 + c24540; _dwks42 = max(0,_dwks40-_taxinc); c24610 = max(0,_dwks39-dwks42); / income subject to 25% tax / c24615 = .25 * c24610; / 25% Tax _/ _dwks45 = c24540+c24532+_dwks31+c24610; c24550 = max(0,_taxinc - dwks45); / income subject to 28% tax / c24570 = .28 * c24550; / 28% Tax / end; \ 2003;

/start rev/ if flpdyr ge 2004 and flpdyr le 2012 then do; _dwks21 = min(_taxinc,c24517); c24597 = max(0,dwks21-c24534); /* income subject to 15% tax / c24598 = .15 * c24597; / 15% Tax / _dwks25 = min(_dwks9,e24515); _dwks26 = c24516 + c24540; _dwks28 = max(0,_dwks26-_taxinc); c24610 = max(0,_dwks25-dwks28); / income subject to 25% tax/ c24615 = .25 * c24610; / 25% Tax _/ _dwks31 = c24540 + c24534 + c24597 + c24610; c24550 = max(0,_taxinc - dwks31); / income subject to 28% tax _/ if pufmake then c24550 = e24550; c24570 = .28 * c24550; / 28% Tax / end; 2004-2012;

if flpdyr ge 2013 then do; _dwks21 = min(_taxinc,c24517); _dwks23 = max(0,_dwks21-c24534);
_dwks24 = _brk6{flpdyr,MARS}; _dwks25 = min(_taxinc,_dwks24); _dwks26 = c24534 + c24540; _dwks27 = max(0,_dwks25 - _dwks26); c24597 = min(_dwks23,dwks27); /* income subject to 15% tax / c24598 = .15 * c24597; / 15% Tax / _dwks30 = c24534 + c24597; c24600 = _dwks21 - dwks30; / income subject to 20% tax _/ c24605 = .2c24600; /* 20% Tax /
_dwks33 = min(_dwks9,e24515); _dwks34 = c24516 + c24540; _dwks36 = max(0,_dwks34 - _taxinc); c24610 = max(0,_dwks33 - dwks36); / income subject to 25% tax / c24615 = .25 * c24610; / 25% Tax _/ _dwks39 = c24540 + c24534 + c24597 + c24600 + c24610; c24550 = _taxinc - dwks39; / income subject to 28% tax / c24570 = .28 * c24550; / 28% Tax / end; *2013; %TAXER(c24540,c24560,MARS); / e24560 non-Schedule D Tax Amount */ if _pufmake then c24560 = e24560;

_taxcg = c24535 + c24598 + c24605 + c24615 + c24570 + c24560; if flpdyr eq 2003 then _taxcg = c24587 + c24595 + _taxcg; c24580 = min(_taxcg,_xyztax); /* e24580 schedule D tax / end; 2003+;

/end rev/

*nocg: ; c05100 = c24580; c05100 = max(0,c05100-_feitax);

c74400 = 0;

if f8615 and e73100 gt 0 then do; Kiddie gets credit for parents tax since his taxable income included parents; c72900 = _kidinv{flpdyr}; c73000= max(0,e72800 - c72900); c73020 = c04800; c73100 = min(c73020,c73000); c73400 = e73200 + e73300 + c73100; if _exact and flpdyr ge 1994 then do; c73500 = e73500; c73600 = e73600; end; else do; %taxer(c73400,c73500,_prntmr); %taxer(e73200,c73600,_prntmr); end; c73700 = c73500 - c73600; c73800 = c73100 + e73300; c73900 = 1; if c73800 gt 0 then c73900 = c73100/c73800; c74000 = c73700 \ c73900; c74100 = c73020 - c73100; %taxer(c74100,c74160,MARS); c74200 = c74000 + c74160; c74300 = c05100; c74400 = max(c74200,c74300); c05100 = c74400; end;

/* Form 4972 - Lump Sum Distributions */

c05700 = 0; if F4972 then do; c59430 = max(0,e59410-e59420); c59450 = c59430 + e59440; /* Income plus lump sum _/ c59460 = max(0,min(.5_c59450,10000) - .2_max(0,c59450 - 20000)); _line17 = c59450 - c59460; _line19 = c59450 - c59460 - e59470; _line22 = 0; if c59450 gt 0 then _line22 = max(0,e59440 - e59440_c59460/c59450); if _pufmake then do; c59460 = e59460; c59450 = e59450; c59430 = e59430; c59485 = e59485; end;

/_tax savings from 5 year option years before 2000 / if flpdyr le 1999 then do; line23 = .2(c59450 - c59460 - e59470); %TAXER(_line23,_line24,1) _line25 = 5__line24; if e59440 eq 0 then _line29 = _line25; else if e59440 gt 0 then do; _line26 = .2__line22; %TAXER(_line26,_line27,1) _line28 = 5_line27; _line29 = max(0,_line25-_line28); end; c59485 = _line29; end;

if (_numxtr gt 0 and flpdyr le 1999) or flpdyr ge 2000 then do; /_tax savings from 10 year option / _line30 = .1_max(0,(c59450 - c59460 - e59470)); _line31= .11 \ min(_line30,1190) /Tax on income + lump sum/

if flpdyr GE 2011 then _s1291 = e10105; else _s1291 = 0; if flpdyr GE 2011 then _parents = e83200_0; else _parents = e84200; c05750 = max(c05100+_parents+c05700,e74400); if flpdyr ge 2011 then c05750 = c05750 + e10105; _taxbc = c05750;

/* Additional Medicare tax on unearned Income _/ c09740 = 0; if flpdyr ge 2013 then do; if _exact then c85190 = e85190; else c85190 = e00300+e00600+max(0,c01000)+max(0,e02000-e26270-e85180+e85070+e85080); c85300 = .038_min(c85190,max(0,c00100-_thresx{MARS})); c09740 = c85300; end;

if _medfix then c09740 = e09740;

/* Alternative Minimum Taxable Income */ c62730 = 0; c62746 = 0; c62748 = 0; c62749 = 0; c62750 = 0; c62760 = 0; c62720 = c24517; c60260 = e00700; if flpdyr ge 1994 then c63100 = max(0,_taxbc-e07300); else c63100 = max(0,_taxbc);

if _exact and f6251 and not _puf then do; c60200 = e60200; c60240 = e60240; c60220 = e60220; c60130 = e60130; c62720 = e62720; end; else do; * Take deductions from Schedule A; if flpdyr le 2012 or _numxtr gt 0 then c60200 = min(c17000,.025*_posagi); else c60200 = 0;

c60240 = c18300; c60130 = c21040; if flpdyr in(2009,2010) then c60240 = c60240 - e18600; c60220 = c20800; if fded eq 3 then do; * Take deductions from taxpayer report before SOI edit; if not missing(t18300) then c60240 = t18300; if flpdyr in(2009,2010) and not missing(t18600) then c60240 = c60240 - t18600; if not missing(t20800) then c60220 = t20800; if not missing(t21040) then c60130 = t21040; if not missing(t17000) then c60200 = min(t17000,.025*_posagi); end; c62720 = c24517; end;

if _exact and f6251 then c62730 = e62730; else c62730 = e24515;

if _exact then c60820 = e60820; else c60820 = 0;*max(c19700,t19700) + max(e20200,t20200);

if c04470 eq 0 and fded ne 3 then do; if flpdyr lt 2002 then _prefded = _stndrd; else _prefded = 0; end; else do; _prefded = c60200 + c60220 + c60240; if flpdyr lt 1998 then _prefded = _prefded + c60820; end;

_totded = c21060 - c21040;

if fded eq 3 then do; if _puf then c60000 = c00100 - e04470; else c60000 = c00100 - max(/s04470,/t04470,e04470); end; else if c04470 gt 0 then c60000 = c00100 - _totded; else do; c60000 = c00100; if FLPDYR lt 2002 then c60000 = c60000 - _stndrd; end;

if (2005<FLPDYR<=2009) then c60000 = c60000 - _katxmp; if flpdyr ge 2008 then c60000 = c60000 - e04805; if fded eq 1 or (_prefded + e60290 gt 0) then _addamt = _prefded + e60290 - c60130; else do; if flpdyr lt 2002 then _addamt = (c04100 + c04200)*(FDED ne 3); if flpdyr ge 2002 then _addamt = 0; end;

if _puf then do; if flpdyr lt 2002 then do; if _stndrd eq 0 or (_exact and e04470 gt 0) then c62100 = min(c17000,.025_max(0,c00100)) + e61850

if _pufmake then c62100 = c60000 + e61850; if _puf or _pufmake then c62100 = c60000 + p61850 + p60100;

if MARS eq 3 or MARS eq 6 then do; _amtspa = max(0,min(_almsep(flpdyr),.25*(c62100-_amtsep{flpdyr}))); c62100 = c62100 + _amtspa; end;

c62600 = max(0,_amtex{flpdyr,MARS}-.25*max(0,c62100-_amtys{flpdyr,MARS},0));

if _agep le _amtage{flpdyr} and _agep ne 0 then c62600 = min(c62600,_earned + _almdep{flpdyr});

c62700 = max(0,c62100 - c62600); _alminc = c62700; _amtfei = 0; if c02700 gt 0 and flpdyr GE 2006 then do; _alminc = max(0,c62100 - c62600); _amtfei = .26_c02700 + .02_max(0,c02700 - _almsp{flpdyr}/_sep); end; c62780 = .26__alminc + .02_max(0,_alminc - _almsp{flpdyr}/_sep)-_amtfei; if f6251 then c62900 = e62900; else c62900 = e07300; c63000 = c62780 - c62900; if _exact then c62740 = e62740; else do; c62740 = min(max(0,c24516),c62720+c62730); if c24516 eq 0 then c62740 = c62720+c62730; end; *exact;

if flpdyr le 2001 then _ngamty = max(0,_alminc-min(c62740,c62730+c62720)); else _ngamty = max(0,_alminc-c62740);

c62745= .26__ngamty + .02_max(0,_ngamty-_almsp{flpdyr}/_sep); _tamt2 = 0;

if 1997<=FLPDYR<=2000 then do; _amt10pc = min(max(0,_brk2(flpdyr,MARS)-c24520), min(_alminc,c62720)); _amt10pc = min(_alminc,c62720,c24590); c62750 = _cgrate1{flpdyr}__amt10pc; _amt20pc = min(_alminc,c62720)-_amt10pc; _amt25pc = max(0,_alminc-_ngamty - _amt10pc - _amt20pc); c62760 = _cgrate2{flpdyr}__amt20pc; c62770 = .25*_amt25pc; _tamt2 = c62750 + c62760 + c62770; end;

if flpdyr in(2001,2002) then do; if min(c24581,min(_alminc,c62720)) eq 0 then do; c62749 = 0; c62750 = 0; end; else do; _amt8pc = min(min(c24581,min(_alminc,c62720)),e62748); c62749 = .08amt8pc; _amt10pc = min(c24581,min(_alminc,c62720)) - _amt8pc; c62750 = _cgrate1{flpdyr}amt10pc; end; _amt20pc = min(_alminc,c62720) - min(c24581,min(_alminc,c62720)); c62760 = _cgrate2{flpdyr}amt20pc; if flpdyr eq 2002 then _amt25pc = max(0,min(_alminc,c62740) - min(_alminc,c62720)); else if flpdyr eq 2001 then _amt25pc = _alminc - (_ngamty + min(_alminc,c62720,c24581)+_amt20pc); c62770 = .25amt25pc; _tamt2 = c62749 + c62750 + c62760 + c62770; end;

if flpdyr eq 2003 then do; c62746 = c24532; c62748 = e24583; _line45 = min(_alminc,c62720,c24532); _line46 = c62746; _amt5pc = max(0,min(_line46,_line45)); c62747 = .05amt5pc; if _line45 gt 0 then do; _line49 = max(0,_line45 - _amt5pc); _line50 = c62748; _amt8pc = min(_line49,_line50); c62749 = .08amt8pc; _amt10pc = _line49 - _amt8pc; c62750 = .1amt10pc; end; else if _line45 eq 0 then do; _amt8pc = 0; _amt10pc = 0; c62749 = 0; c62750 = 0; end; _line55 = c62746 - _amt5pc; _line56 = min(c62720,_alminc) - _line45; _amt15pc = min(_line55,_line56); c62755 = .15__amt15pc; _amt20pc = _line56 - _amt15pc; c62760 = .2amt20pc; if c62730 gt 0 then _amt25pc = max(0,min(_alminc,c62740) - min(_alminc,c62720)); else _amt25pc = 0; c62770 = .25__amt25pc; _tamt2 = c62747 + c62749 + c62750 + c62755 + c62760 + c62770; end;*2003;

if flpdyr ge 2004 then do; if flpdyr ge 2008 then do; _amt5pc = 0; _amt15pc = min(_alminc,c62720)-min(max(0,_brk2(flpdyr,MARS) -c24520),min(_alminc,c62720)); if c04800 eq 0 then _amt15pc = max(0,min(_alminc,c62720)-_brk2(flpdyr,MARS)); _amt25pc = min(_alminc,c62740) - min(_alminc,c62720); end; else do; _amt5pc = min(max(0,_brk2(flpdyr,MARS)-c24520),min(_alminc,c62720)); _amt15pc = min(_alminc,c62720) - _amt5pc; _amt25pc = max(0,_alminc-_ngamty - _amt5pc - _amt15pc); end;

c62747 = _cgrate1{flpdyr}__amt5pc; c62755 = _cgrate2{flpdyr}__amt15pc; c62770 = .25*_amt25pc; _tamt2 = c62747 + c62755 + c62770;

if flpdyr ge 2013 then do;
_xl44 = c24520; if c04800 = 0 then _xl44 = 0; _xl45 = max(0,_brk2{flpdyr,MARS}-_xl44); _xl46 = min(c62720,_alminc); _amt013 = min(_xl45,_xl46); * this amount is taxed at 0%; _xl48 = _xl46 - _amt013; _xl49 = max(0,_brk6{flpdyr,MARS} - (_xl45 + c24540)); _amt1513 = min(_xl48,_xl49); * this amount is taxed at 15%; c62755 = .15 * _amt1513; _amt2013 = _xl46 - (_amt013 + _amt1513); * this amount is taxed at 20%; c62760 = .2 * _amt2013; _amt25pc = max(0,_alminc - (_ngamty + _amt013 + _amt1513 + _amt2013)); c62770 = .25 * _amt25pc; * this amount is taxed at 25%; _tamt2 = c62755 + c62760 + c62770; end;*2013+;

end;*2004+;

c62800 = min(c62780,c62745+_tamt2-_amtfei); c63000 = c62800 - c62900; c63100 = _taxbc - e07300 - c05700; if flpdyr ge 2011 then c63100 = c63100 + e10105;

c63100 = max(0,c63100); c63200 = max(0,c63000 - c63100);

if (_exact or _pufmake) and f6251 eq 0 then do; c63200 = 0;
end; c09600 = c63200;

if c09600 eq 0 and e60000 eq 0 then do; c60000 = 0; c62100 = 0; end;

if (_exact or _pufmake) and (f6251 eq 0 and e09600 eq 0) then do; c62100 = 0; c09600 = 0; end;

if flpdyr ge 2000 then c05800 = _taxbc + c09600; else c05800 = _taxbc;

/* form 2441 Child and Dependent Care Credit */

if _fixeic = 1 then _earned = e59560; if MARS eq 2 then do; if _puf and flpdyr ge 2009 then do;
c32880 = _esplit__earned; c32890 = (1-_esplit)__earned; end; else if not missing(e32890) then do; c32880 = max(0,e32880); c32890 = max(0,e32890); end; else do; c32880 = _earned/2; c32890 = _earned/2;
end; end; else do; c32880 = _earned; c32890 = _earned; * Helps for single returns; end;

_dclim = min(f2441,2)*_dcmax{flpdyr};

if _puf or flpdyr le 1998 then _ccexp = e32800; else _ccexp = e32700;

/* Part III of Dependent Care Benefits Form 2441 Part III */

_secwage = 0; c32800 = 0; c32840 = 0; if f2441 gt 0 then do; if FLPDYR ge 2004 then do; if MARS eq 2 then _secwage = min(c32880,c32890,min(e33420 + e33430 - e33450,e33460)); else _secwage = min(c32880,min(e33420 + e33430 - e33450,e33460));

c33465 = e33465;
c33470 = e33470;
c33475 = max(0,min(_secwage,5000/_sep) - c33470);
c33480 = max(0,e33420 + e33430 - e33450 - c33465 - c33475);
c32840 = c33470 + c33475;
c32800 = min(max(0,min(_ccexp,_dclim)-c32840),_ccexp);

end; else do; c32840 = min(min(min(e33420-e33450,e33460),c32880,c32890),5000/_sep); c33480 = e33420 - e33450 - c32840; c32800 = min(max(0,_dclim-c32840),max(0,max(0,_ccexp,e32700)-c32840)); end; if _pufmake or _puf then c32800 = e32800; end;

if _pufmake and f2441 eq 0 then c32800 = 0; c33000 = max(0,min(c32800, c32880,c32890));

/* Expenses limited to earned income */

if _round then do; _tratio = ceil(max((c00100 - agcmax{flpdyr})/2000,0)); c33200 = c33000.01_max(20,_pcmax{flpdyr} - min(15,tratio)); end; else c33200 = c33000.01_max(20,_pcmax{flpdyr}-max((c00100 - _agcmax{flpdyr})/2000.,0.));

x33200 = c33200; xpcmax = _pcmax{flpdyr}; xagcmax = _agcmax{flpdyr};

if f2441 eq 0 then c07180 = 0; else c07180 = min(max(0,c05800 - e07300), c33200);

if c07180 eq 0 then c33000 = 0;

/* Credit for Elderly and Disabled */ c07200 = 0; if _numxtr gt 0 then do; if _numxtr ge 2 or FLGSTR gt 0 then c28300 = 7500/_sep; else c28300 = 5000;

c28400 = max(0,e28350 + e28375); if MARS in(2,3,6) then c28500 = max(0,c00100-10000/_sep); else c28500 = max(0,c00100-7500);

c28600 = .5_c28500; c28700 = c28600 + c28400; c28800 = max(0,c28300-c28700); c28900 = min(.15_c28800,max(0,c05800-e07300-c07180)); c07200 = c28900; end;

/* Rate reduction credit for 2001 only */

if dsi eq 0 and c04800 gt 0 and flpdyr eq 2001 and e07970 gt 0 then do; if MARS in(1,3,6) then c07970 = min(300,c05800); else if MARS eq 4 then c07970 = min(500,c05800); else if MARS in(2,5) then c07970 = min(600,c05800); else do; put "Taxcalc: Invalid " MARS= recid=; abort;end; end; else if flpdyr ge 2009 then c07970 = e07970; else c07970 = 0;

/* Number of dependents for EIC */

_ieic = max(EIC,(EICYB1>0) + (EICYB2>0) + (EICYB3>0));

/* Modified AGI only through 2002_/ _modagi = c00100 + e00400; if flpdyr lt 2003 then do; if c01000 lt 0 then _modagi = _modagi - c01000; if e00900 lt 0 then _modagi = _modagi - .75_e00900; end;

c59560 = 0; c59660 = 0; _val_ymax = 0; _preeitc = 0;

if _exact and not _pufmake then c59560 = e59560; else c59560 = _earned;

if MARS in(1,2,4,5,7) then do; if MARS eq 2 then _val_ymax = _ymax(_ieic,flpdyr) + _joint{flpdyr}; else _val_ymax = _ymax(_ieic,flpdyr); c59660 = min(_rtbase{_ieic,flpdyr}_c59560,_crmax{_ieic,flpdyr}); _preeitc = c59660; if _modagi gt _val_ymax or c59560 gt _val_ymax then do; _preeitc = max(0,_crmax{_ieic,flpdyr}-_rtless{_ieic,flpdyr}_max(0,max(_modagi,c59560)-_val_ymax)); _preeitc = min(_preeitc,c59660); end; _val_rtbase = _rtbase{_ieic,flpdyr}_100; _val_rtless = _rtless{_ieic,flpdyr}_100; /* disqualified income for EITC starts in 1997 */ if flpdyr ge 1997 then do; _dy= e00400 + max(e83080,e83080_0) + e00300 + e00600

if _dy gt _dylim{flpdyr} and not (_pufmake and e59680 gt 0) then _preeitc = 0;

end; end;

if _puf or _pufmake or _ieic gt 0 or (25 le _agep le 64) or (mars eq 2 and (25 le _ages le 64)) then do; c59660 = _preeitc; end; else do; c59660 = 0; c59560 = 0; end;

if _pufmake and e59660 eq 0 then do; c59560 = 0; c59660 = 0; end;

/* Child tax credit */

c11070 = 0; c07220 = 0; c07230 = 0; c87550 = 0; _precrd = 0;

_num = 1; if MARS eq 2 then _num = 2;

c87668 = 0; c10960 = 0; c87520 = 0; c87521 = 0; c87522 = 0; c87524 = 0; c87526 = 0; c87528 = 0; c87530 = 0; c87550 = 0; c87654 = 0; c87656 = 0; c87658 = 0; c87660 = 0; c87662 = 0; c87664 = 0; c87666 = 0; c87681 = 0; c87668 = 0;

if flpdyr ge 1998 then do; _precrd = _chmax{flpdyr}*_nctcr; if flpdyr ne 2001 then _ctcagi = sum(c00100,_feided); else _ctcagi = c00100 + e34900 + e35200 + e35500;

if _ctcagi gt _cphase(MARS) then do;
   if _round then
      _precrd=max(0,_precrd-50*ceil(max(0,_ctcagi-_cphase(MARS))/1000));
   else
      _precrd=max(0,_precrd-50*(max(0,_ctcagi-_cphase(MARS))+500)/1000);

end;

/* Form 8863 Hope Credit for 1998-2009 */

 if _puf then do;
    if flpdyr in (1998,1999,2005:2009) then
       c87520 = e87520;
     else if flpdyr in(2000:2004) then
       c87520 = e87500 + e87510;
 end;
 else do;
    if flpdyr in(2002:2009) then do; 
      _hope = _hopelm{flpdyr};
       if _katrina gt 0 and flpdyr in(2005,2009) then  _hope = 2*_hopelm{flpdyr};
       c87480 = max(0,min(e87480,2*_hope));
       c87485 = max(0,min(e87485,2*_hope));
       c87490 = max(0,min(e87490,2*_hope));
       c87495 = max(0,min(e87495,2*_hope));

       if flpdyr in(2002:2004) then do;  
          c87481 = .5*(c87480 - min(c87480,_hope));
          c87486 = .5*(c87485 - min(c87485,_hope));
          c87491 = .5*(c87490 - min(c87490,_hope));
          c87496 = .5*(c87495 - min(c87495,_hope));
          c87500 = min(c87480,_hope) + min(c87485,_hope) + min(c87490,_hope) + min(c87490,_hope);
          c87510 = c87481 + c87486 + c87491 + c87496;
          c87520 = c87500 + c87510;
       end;
       else if flpdyr in(2005:2009) then do;
          c87481 = .5*(c87480 + min(c87480,_hope));
          c87486 = .5*(c87485 + min(c87485,_hope));
          c87491 = .5*(c87490 + min(c87490,_hope));
          c87496 = .5*(c87495 + min(c87495,_hope));
          c87520 = c87481 + c87486 + c87491 + c87496; 
          c87520 = c87481 + c87486 + c87491 + c87496;
       end;
    end;
    else if flpdyr in(1998:2001) then do; 
       c87500 = e87500;
       c87510 = e87510;
       c87520 = c87500 + c87510;
       end;     
 end;         

/* Form 8863 American Opportunity Credit 2009+*/

   if flpdyr ge 2009 then do;
      c87482 = max(0,min(e87482,4000));
      c87487 = max(0,min(e87487,4000));
      c87492 = max(0,min(e87492,4000));
      c87497 = max(0,min(e87497,4000));
      if max(0,c87482-2000) eq 0 then 
         c87483 = c87482; 
      else 
         c87483 = 2000+.25*max(0,c87482-2000); 
      if max(0,c87487-2000) eq 0 then 
         c87488 = c87487; 
      else 
         c87488 = 2000+.25*max(0,c87487-2000);
      if max(0,c87492-2000) eq 0 then 
         c87493 = c87492; 
      else 
         c87493 = 2000+.25*max(0,c87492-2000);
      if max(0,c87497-2000) eq 0 then 
         c87498 = c87497; 
      else 
         c87498 = 2000+.25*max(0,c87497-2000);

         c87521 = c87483 + c87488 + c87493 + c87498;
         if _puf then c87521 = p87521;
   end;
   if _pufmake then do;
      c87521 = p87521;
      c87482 = p87482;
   end;

/* Form 8863 Lifetime Learning Credit*/

if _puf then do;
   if flpdyr in(1998,1999) then do;
      c87540 = 0;
      c87550 = e87550;
      end;
   else if flpdyr ge 2000 then do;
      c87540 = min(sum(e87530),_learn{flpdyr})  ;
      c87550 = .2*c87540;
   end;
end;   
else do; 
   if flpdyr in(1998:2001) then  
      c87530 = e87530;
   else if flpdyr ge 2002 then 
      c87530 = e87526 + e87522 + e87524 + e87528;

   c87540 = min(c87530,_learn{flpdyr});
   c87550 = .2*c87540;   
  if _katrina gt 0 and flpdyr in(2005:2009) then c87550 = .4*c87540;
end;

/* Refundable American Opportunity Credit 2009+*/

if flpdyr ge 2009 and c87521 gt 0 then do;
   c87654 = 90000*_num;
   c87656 = c00100;
   c87658 = max(0,c87654 - c87656);
   c87660 = 10000*_num;
   c87662 = 1000*min(1,c87658/c87660);
   c87664 = c87662*c87521/1000.;
   if EDCRAGE eq 1 or (_puf and e10960 eq 0) then c87666 = 0; else c87666= .4*c87664;
   c10960 = c87666;
   c87668 = c87664 - c87666;
   if _pufmake and flpdyr ge 2009 then c10960 = e10960;
end;

/* Nonrefundable Education Credits */

/* Form 8863 Tentative Education Credits*/ if flpdyr ge 1998 then c87560 = c87520 + c87550;

/Phase out/ if MARS eq 2 then c87570 = _edphhm{flpdyr}_1000; else c87570 = _edphhs{flpdyr}_1000; c87580 = c00100; c87590 = max(0,c87570 - c87580); if c87590 gt 0 then do; c87600 = 10000_num; c87610 = min(1,c87590/c87600); c87620 = c87560 \ c87610; end; else do; c87610 = 0; c87620 = 0; end; if flpdyr le 2008 then do; c87630 = c05800; c87640 = e07300 + c07180 + c07200; c87650 = c87630 - c87640; if c87650 le 0 then do; c87680 = 0; c07230 = 0; end; else do; c07230 = min(c87620,c87650); c07230 = min(c87620,c87650); end; end; else if flpdyr eq 2009 then do; c87625 = c87620 + c87668; if c87625 eq 0 then do; c87680 = 0; c07230 = 0; end;
else do; c87680 = c87625; c07230 = c87625; end; end; else if flpdyr ge 2010 then do; _xlin4 = max(0,c05800 - (e07300 + c07180 + c07200)); _xlin5 = min(c87620,_xlin4); _xlin8 = e07300 + c07180 + c07200 + _xlin5; _xlin9 = max(0,c05800 - (e07300 + c07180 + c07200 + _xlin5)); _xlin10 = min(c87668,_xlin9); c87680 = _xlin5 + _xlin10; c07230 = c87680; end; end;

_ctc1 = c07180 + c07200 + c07230; _ctc2 = 0; if flpdyr eq 2001 then _ctc2 = c07970; if flpdyr in(2002:2005,2008) then _ctc2 = e07240; if flpdyr eq 2006 then _ctc2 = e07240 + e07260; if flpdyr ge 2009 then _ctc2 = e07240 + e07960 + e07260; if flpdyr ge 2000 then _ctc2 = _ctc2 + e07300;

_regcrd = _ctc1 + _ctc2;

/* Adoption Credit Form 8839 */

c11450 = 0; c07250 = 0; c86160 = 0; if F8839 then do;

_exocrd = e07700 + c07250; if flpdyr ge 1997 then _exocrd = _exocrd + t07950; _ctctax = c05800 - _regcrd -_exocrd;

if flpdyr eq 2009 then _ctctax = c05800 -(c07180+c07230+e07300+e07240+e64620+e36630+e51090+e52560+e28900); c07220 = min(_precrd,max(0,_ctctax)); /* lt tax owed */ if _pufmake eq 1 and n24 eq 0 then c07220 = 0; ;

c10950 = 0;

c87825 = _earned; if _exact and not missing(e87825) and not _pufmake then c87825 = e87825;

if flpdyr eq 2009 or flpdyr eq 2010 then do; if _earned gt 6451txp then do; c87825 = 0; c87830 = 0; c87835 = 0; c87840 = 0; c87845 = 400txp; end; else do;
c87830 = e87830; c87835 = .062_c87825; c87840 = 400__txp; c87845 = min(c87835,c87840); end;

if flpdyr in(2009,2010) then if _exact then c87845 = .062_min(max(_earned,e87825),_txp_6451); else c87845 = .062_min(_earned,_txp_6451);

c87850 = c00100 + _feided;
c87855 = 75000*_txp;
c87860 = max(0,c87850 - c87855);
c87865 = .02*c87860;
c87870 = max(0,c87845 - c87865);
c87875 = e87875;
if flpdyr eq 2009 then do;
   c87885 = c87875 + e87880;
   c87890 = max(0,c87870-c87885);
   c87895 = e87880 + c87890;
  end;
else 
   c87895 = max(0,c87870-c87875);
c10950 = c87895;

end;

_otax = e09900 + e09800 + e10100 + e10000; if _exact then _otax = _otax + e09400; else _otax = _otax + c09400; if _pufmake then c10950 = e10950;

/* Form 5405 First-Time Homebuyer credit*/

c11580 = 0; if f5405 then do; if flpdyr in(2009,2010) then do; c64482 = .1_e64481; c64483 = min(8000/_sep,e64483); c64485 = min(c64482,c64483); if flpdyr eq 2009 then do; c64484 = 75000; if MARS eq 2 then c64484 = 150000; end; else do; c64484 = 125000; if MARS eq 2 then c64484 = 225000; end; c64487 = max(0,c00100 + c02700 - c64484); if c64487 gt 20000 then c64490 = 0; else do; c64489 = c64485_c64487/20000; c64490 = c64485 - c64489; end; c11580 = c64490; end; else if flpdyr eq 2008 then do; c64445 = min(7500/_sep,e64445); c64446 = c00100; if MARS eq 2 then c64447 = max(0,c64446-150000); else c64447 = max(0,c64446 - 75000);

if c64447 gt 20000 then c64450 = 0; else do; c64448 = c64447/20000; c64449 = c64445_c64448; c64450 = c64445 - c64449; end; c11580 = c64450; end; end; x64489 = 1000_sum(0,c64489); if _pufmake then c11580 = e11580;

/* Allocate credits to tax in order on the tax form */

_avail = c05800; xavail01 = _avail; c07180 = min(c07180,_avail); _avail = _avail - c07180; xavail02 = _avail; c07200 = min(c07200,_avail); _avail = _avail - c07200; xavail03 = _avail; c07300 = min(e07300,_avail); _avail = _avail - c07300; xavail04 = _avail; if flpdyr ge 1998 then c07230 = min(c07230,_avail); else c07230 = 0; _avail = _avail - c07230; xavail05 = _avail; c07240 = min(e07240,_avail); _avail = _avail - c07240; xavail06 = _avail; c07250 = min(c07250,_avail); _avail = _avail - c07250; xavail07 = _avail; c07260 = min(e07260,_avail); _avail = _avail - c07260; xavail08 = _avail; xavail09 = _avail; c07600 = min(e07600,_avail); _avail = _avail - c07600; if flpdyr ge 2009 then do; c07980 = min(e07980,_avail); _avail = _avail - c07980; xavail10 = _avail; end; c07220 = min(c07220,_avail); _avail = _avail-c07220; xavail11 = _avail;

/* Form 8812 Additional Child Tax Credit */

c82940 =0; if (flpdyr in(1998:2000) and _nctcr gt 2) or (flpdyr ge 2001 and _nctcr gt 0) then do;

if e82915 gt 0 and abs(e82940-c82940) gt 100 then _othadd = e11070 - c11070; if _fixup ge 4 then c11070 = c11070 + _othadd; end;

if flpdyr lt 2000 then _otax = _otax + c09600; if flpdyr ge 1994 then _otax = _otax + sum(0,e09700); if flpdyr ge 1995 then _otax = _otax + e10050; if flpdyr ge 1996 then _otax = _otax + e10075; if flpdyr ge 2007 then _otax = _otax + e09805; if flpdyr ge 2009 then _otax = _otax + e09710 + e09720; if flpdyr ge 2013 then _otax = _otax + c09730 + c09740;

/* Total Credits 1040 line 48 */

c07100 = c07180 + c07200 + c07600 + c07250 + c07300 + e07400

c08795 = max(0,c05800 - c07100);

*tax before refundable Credits;

c09200 = c08795 + _otax;

*Telephone Excise Tax Credit for 2006 only;

c11600 = 0; if flpdyr eq 2006 then do; if _XTOT eq 1 then c11600 = 30; else if _XTOT eq 2 then c11600 = 40; else if _XTOT eq 3 then c11600 = 50; else if _XTOT ge 4 then c11600 = 60; end;

_refund = c59660 + c11070 + c10950 + c11600 + c10960; if flpdyr ge 1994 then _refund = _refund + e11400; if flpdyr ge 2005 then _refund = _refund + e11500; if flpdyr ge 2008 then _refund = _refund + e11580; if flpdyr in(2008:2010) then _refund = _refund + e11570; if flpdyr ge 2010 then _refund = _refund + c11450;

_taxsim = c08795 - _refund - e82040;

/* We take stimulus payment to be part of tax */

if e10950 eq 0 and _exact then c10950 = 0;

if flpdyr in(2009:2010) then do; _mwplft1 = min(c10950,_avail); _avail = _avail - _mwplft1; end; else _mwplft1 = 0; _avail6 = _avail; c59680 = min(c59660,_avail); _avail = _avail-c59680; _avail = max(0,_avail-e07170);

c07150 = c07100 + c59680; if flpdyr eq 2008 then c07150 = c07150 + e11570 + c11580; if flpdyr ge 2007 then c07150 = c07150 + e11550; if flpdyr in(2009,2010) then do; if _puf then c82041 = e82200;else c82041 = e82041; c07150 = c07150 + c10950 + c87681 + c11581 + c82041 + e11570; end; if flpdyr eq 2010 then c07150 = c07150 + e11451; if flpdyr ge 2011 then c07150 = c07100 + e11601; c07150 = min(c07150,c05800); c08800 = c05800 - c07150;

c06500 = c08800; if flpdyr in(1994:2000) then c06500 = c06500 + c09600; if flpdyr in(1994:2010) then c06500 = c06500 - c59700 - c59720; if flpdyr ge 1996 then c06500 = c06500 + e10075; if flpdyr eq 2008 then c06500 = c06500 - e11550 - e11570 - e11580; if flpdyr in(2009:2010) then c06500 = c06500 - c11582 - c11583 - e82042 - e82043 - c87682 - c87683 - e87905 - e87910; if flpdyr eq 2010 then c06500 = c06500 - e11452 - e11453;
if flpdyr ge 2011 then c06500 = c06500 - e11602 - e11603; if flpdyr ge 2013 then c06500 = c06500 + c09730 + c09740; c06500 = max(0,c06500);

/SOI Tax (Tax after non-refunded credits plus tip penalty /

_pymnts = c59660 + c10950 + c10960 + e11400 + c11070 + e10000; if flpdyr ge 2007 then _pymnts = _pymnts + e11550; if flpdyr ge 2008 then _pymnts = _pymnts + c11580; if flpdyr in(2008:2010) then _pymnts = _pymnts + e09710 + e11570; if flpdyr ge 2009 then _pymnts = _pymnts + e09720; if flpdyr in(2010,2011) then _pymnts = _pymnts + c11450; if flpdyr ge 2011 then _pymnts = _pymnts + e11500; c10300 = max(0,c09200-_pymnts);

c10600 = e10610 + e10700 + e10900 + c10950 + c10960 + e11000 + c11070 + e11100 + e11200 + e11300 + e11400 + e11500 + e11550 + c11580 + c59660 + t87705; if flpdyr in(2008:2010) then c10600 = c10600 + e11570; if flpdyr in(2010,2011) then c10600 = c10600 + c11450; c11900 = c09200 + e12200 - c10600;

_nbertax = c09200 - _refund - e82040 + e12200 - e11300; _soitax = sum((1-(_pufmake or _puf))_e11900,(_pufmake or _puf)_sum(0,p11900)) + e10700 + e10900 + e11100 + e11200; %MEND COMP; %MACRO STATAX(IN,OUT); /* To use this macro the taxsim9 binary must be in the executable path. The "IN" argument is a SAS format datafile with the SOI E-codes. The "OUT" argument is a new SAS format datafile with all of the "IN" variables, and 41 additional variables. The new variables are documented at http://www.nber.org/taxsim/taxsim-calc9.html */ data _taxpayer; set &IN; array _x _x01 _x02 _x03 _x04 _x05 _x06 _x07 _x08 _x09 _x10 _x11 _x12 _x13 _x14 _x15 _x16 _x17 _x18 _x19 _x20 _x21 _x22; _posagi = max(0.0d0,E00100); _x01 = n;retain _aged ( _x02 = flpdyr;

if STATE ne . then _x03 = STATE; else _x03 = 0;

array _mars24{1:5} temporary; retain _mars24 (1 2 6 3 5); _x04 = _mars24{MARS}; if DSI gt 0 then _x04 = 8; _x05 = sum(XOCAH, XOCAWH, XOODEP, XOPAR);

array age(12,1996:2013) temporary; / 1996 1997 1998 1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 / retain age ( 5000 5150 5300 5350 5500 5650 5850 5900 6050 6250 6400 6650 6800 7100 7100 7200 7400 7400 6000 6150 6350 6400 6600 6750 7000 7050 7250 7500 7650 7950 8150 8500 8500 8600 8850 8850 7500 7700 7950 8050 8200 8500 8750 10450 10650 11000 11300 11750 11950 12500 12500 12700 12950 11000 8300 8500 8800 8900 9050 9400 9650 11400 11600 12000 12300 12800 13000 13600 13600 13800 14000 12050 9100 9300 9650 9750 9900 10300 10550 12350 12550 13000 13300 13850 14050 14700 14700 14900 15050 13100 9900 10100 10500 10600 10750 11200 11450 13300 13500 14000 14300 14900 15100 15800 15800 16000 16100 14150
4150 4250 4400 4450 4525 4700 4825 5700 5800 6000 6150 6400 7000 6800 6800 6900 7000 6025 4950 5050 5250 5300 5375 5600 5725 6650 6750 7000 7150 7450 8050 7900 7900 8000 8050 7075 5750 5850 6100 6150 6225 6500 6625 7600 7700 8000 8150 8500 9100 9000 9000 9100 9100 8125 6550 6650 6950 7000 7075 7400 7525 8550 8650 9000 9150 9550 10150 10100 10100 10200 10150 9175 6900 7050 7300 7300 7400 7750 8050 8150 8350 8550 8800 9150 9350 9750 9800 9900 9950 10200 7900 8050 8350 8450 8650 8850 9200 9300 9550 9800 10050 10450 10700 11150 11200 11300 11400 11650 );

array _d9src(12) temporary; retain _d9src ( 1 1 1 2 2 2 1 2 2 2 1 1);

/* Age Exemptions _/; _x06 = 0; if year ge 1962 and year le 1978 then _x06=agex; else if year ge 1982 and year le 1995 then do; if agex eq 0 then _x06 = 0; if agex eq 1 or agex eq 2 then _x06 = 1; if agex eq 3 then _x06 = 2; end; else if year ge 1996 and fded eq 2 then do i = 1 to 12 ; if age(i,year) eq _totald then _x06 = _d9src(i); end; _x06 = min(_x06,2); _x07 = E00200 + E00900; _x07 = sum(E00200,E00900); _x08 = 0; if year le 2002 then _x09 = E00600; else _x09 = E00650; _x10 = sum(E02000,E01400,E00300,E00700,E00800, E01200,E02100,E02600,E01100,E02800) -sum(E02540,E02700,E03150,E03260,E03270,E03300,E03500, E03400,E03280,E03290,E03230,E03210,E03700); _x11 = E01700; _x12 = E02400; _x13 = E00400; x14 = 0; / rent paid_/ _x15 = E18500; _x16 = max(0,E20400-.02posagi); _x17 = E32700; _x18 = E02300; if N24 ne . then _x19 = N24; else _x19 = XOCAH+XOCAWH+XOODEP; _x19 = min(_x19,_x05); _x20 = sum(E19200,max(0,E17500-.075posagi),E19700,max(0,E20500-.1__posagi)); _x21 = E22250; _x22 = E23250;

file "/tmp/txpydata.raw"; if n eq 1 then put "9 85 2 /"; put _x01 _x02 _x03 _x04 _x05 _x06 _x07 _x08 _x09 _x10 _x11 _x12 _x13 _x14 _x15 _x16 _x17 _x18 _x19 _x20 _x21 _x22; run;

x "unset noclobber;./taxsim9 </tmp/txpydata.raw >/tmp/results.raw;" xwait; %PUT 'taxsim9 return code: ' &SYSRC;

data _taxsim; infile "/tmp/results.raw" lrecl=2048; input _x01 year state fiitax siitax fica frate srate ficar v10-v41; run;

data &OUT; merge _taxpayer _taxsim; by _x01; run; %MEND STATAX;

/Schedule D / %MACRO SCHD;

   c22256        c22556 c23650 c23656 c24505 c24510 c24516

c24517 c24520 c24530 c24532 c24533 c24534 c24535 c24540 c24550 c24560 c24567 c24570 c24580 c24581 c24585 c24587 c24590 c24595 c24597 c24598 c24600 c24605 c24610 c24615 c59430 c59450 c59460 c59475 c59480 c59485 c59490

%MEND;

/Form 4972 / %MACRO F4972; c59430 c59450 c59460 c59475 c59480 c59485 c59490 %MEND;

/* Form 8812 */ %MACRO F8812;

c82880 c82885 c82890 c82900 c82905 c82910 c82915 c82920 c82925 c82930 c82935 c82937 c82940

%MEND;

/ EVALUES is a complete list of all variables used by the tax calculator, /

%MACRO EVALUES;

e00100 e00101 e00200 e00250 e00300 e00400 e00600 e00650 e00700 e00800 e00900 e01100 e01200 e01400 e01700 e02000 e02100 e02300 e02400 e02500 e02540 e02600 e02610 e02615 e02700 e02800 e03150 e03200 e03210 e03220 e03230 e03240 e03260 e03270 e03280 e03290 e03300 e03400 e03500 e03600 e03700 e03900 e04000 e04100 e04200 e04250 e04470 e04600 e04800 e04800 e04805 e05100 e05800 e07100 e07170 e07200 e07220 e07230 e07240 e07250 e07260 e07260 e07300 e07400 e07500 e07600 e07700 e07900 e07910 e07920 e07930 e07960 e07970 e07980 e08000 e08001 e09400 e09600 e09700 e09710 e09720 e09730 e09740 e09800 e09805 e09900 e10000 e10050 e10075 e10100 e10105 e10610 e10700 e10900 e10950 e10950 e10960 e11000 e11055 e11070 e11070 e11100 e11200 e11200 e11300 e11400 e11450 e11451 e11452 e11453 e11500 e11500 e11550 e11550 e11570 e11570 e11580 e11580 e11581 e11582 e11583 e11601 e11602 e11603 e11900 e12200 e15210 e15360 e17000 e17500 e18300 e18400 e18425 e18450 e18500 e18600 e18800 e18900 e19200 e19400 e19500 e19530 e19550 e19570 e19700 e19800 e20100 e20200 e20300 e20400 e20500 e20550 e20600 e20800 e20900 e20950 e21000 e21010 e21020 e21040 e21060 e21606 e21626 e21776 e21800 e22250 e22306 e22326 e22366 e22376 e22390 e22550 e23250 e23650 e23660 e24510 e24515 e24516 e24517 e24518 e24520 e24530 e24532 e24534 e24535 e24540 e24550 e24560 e24580 e24583 e25350 e25360 e25400 e25430 e25470 e25500 e25700 e26205 e26210 e26270 e26320 e26340 e27200 e27895 e28900 e30100 e32700 e32750 e32775 e32800 e32880 e32890 e33420 e33430 e33450 e33460 e33465 e33470 e34900 e35200 e35500 e36630 e37717 e40223 e51090 e52560 e58980 e58990 e59400 e59410 e59420 e59430 e59440 e59450 e59460 e59470 e59485 e59490
e59560 e59660 e59680 e60000 e60100 e60130 e60200 e60220 e60240 e60250 e60260 e60290 e60300 e60340 e60405 e60410 e60420 e60430 e60440 e60460 e60480 e60500 e60550 e60600 e60620 e60630 e60640 e60660 e60680 e60720 e60820 e60840 e60860 e60900 e61400 e61850 e62000 e62100 e62720 e62730 e62740 e62746 e62747 e62748 e62900 e64445 e64481 e64483 e64620 e65300 e65400 e72800 e73100 e73200 e73300 e73400 e73500 e73600 e74400 e82040 e82041 e82042 e82043 e82200 e82880 e82882 e82900 e82915 e82940 e83080 e83080_0 e83200_0 e84200 e85070 e85080 e85115 e85180 e85330 e85370 e86090 e86100 e86110 e86112 e86115 e86092 e86094 e86120 e86121 e86122 e86126 e86127 e86160 e86180 e87480 e87482 e87485 e87487 e87490 e87492 e87495 e87497 e87500 e87510 e87520 e87521 e87522 e87524 e87526 e87528 e87530 e87545 e87550 e87682 e87683 e87825 e87830 e87875 e87880 e87905 e87910

p11900 t07400 t08795 t07950 t17000 t18300 t18600 t19700 t20200 t20800 t21040 t34900 t35200 t35800 t35905 t35500 t35800 t86100 s86115 t86120 t87705

%MEND EVALUES;

%MACRO CODES;

xocah xocawh flpdyr soiyr agep ages mars eic n11 N24
xtxcr1 xtxcr2 xtxcr3 xtxcr4 xtxcr5 xtxcr6 xtxcr7 xtxcr8 xtxcr9 xtxcr10
pbi sbi xtot dsi s006 weight flpdmo xoodep t27800 f4972 dobyr eicyb1 eicyb2 eicyb3 cdob1 cdob2 fded sdobyr ssind schj schjin f8814 f2441 DOBMD midr sdobmd f2555 t04470 t35200 t35910 t35911 t07950 t35905 t35500 recid txst f6251 scha f8936 f8839 f8914 schm schd edcrage f8615
sfobyr schl kid kded earnsplit f5405 n11 n24

%MEND CODES;

%MACRO CVALUES; / CVALUES is a complete list of values calculated by the tax calculator. /

c00100 c00650 c01000 c02500 c02650 c02700 c02900 c04100 c04200 c04250 c04470 c04500 c04600 c04800 c05100 c05200 c05700 c05750 c05800 c06300 c06500 c07100 c07100 c07150 c07180 c07220 c07230 c07240 c07250 c07260 c07300 c07600 c07970 c08795 c08800 c09200 c09600 c10300 c10600 c10950 c10960 c11055 c11070 c11580 c11600 c11900 c15100 c15200 c15250 c17000 c17750 c18300 c18400 c19200 c19700 c20100 c20400 c20500 c20750 c20800 c21020 c21040 c21060 c22256 c22556 c23650 c23656 c24505 c24510 c24515 c24516 c24517 c24520 c24530 c24532 c24533 c24534 c24535 c24540 c24550 c24560 c24570 c24580 c24581 c24585 c24587 c24590 c24595 c24597 c24598 c24600 c24605 c24610 c24615 c32800 c32840 c32880 c32890 c33000 c33200 c33400 c33465 c33470 c33475 c33480 c37703 c59430 c59450 c59460 c59485 c59490 c59560 c59660 c59680 c59700 c59720 c60000 c60130 c60200 c60220 c60240 c60260 c62100 c62600 c62700 c62720 c62730 c62740 c62745 c62746 c62747 c62748 c62749 c62750 c62755 c62760 c62770 c62780 c62800 c62900 c63000 c63100 c63200 c64445 c64446 c64447 c64448 c64449 c64450 c64482 c64483 c64484 c64485 c64487 c64489 c64490 c72900 c73000 c73020 c73100 c73400 c73500 c73600 c73700 c73800 c73900 c74000 c74100 c74160 c74200 c74300 c74400 c82041 c82880 c82885 c82890 c82900 c82905 c82910 c82915 c82920 c82925 c82930 c82935 c82937 c82940 c87480 c87481 c87482 c87483 c87485 c87486 c87487 c87488 c87490 c87491 c87492 c87493 c87495 c87496 c87497 c87498 c87500 c87510 c87520 c87521 c87522 c87524 c87526 c87528 c87530 c87540 c87550 c87560 c87570 c87580 c87590 c87600 c87610 c87620 c87625 c87654 c87656 c87658 c87660 c87662 c87664 c87666 c87668 c87680 c87681 c87825 c87835 c87840 c87845 c87850 c87855 c87860 c87865 c87870 c87885 c87890 c87895

c03260 c09400

%MEND CVALUES;

%MACRO CVARS;

00100 00650 01000 02500 02650 02700 02900 03290 04100 04200 04470 04500 04600 04800 04805 05100 05200 05700 05750 05800 07100 07180 07220 07970 08795 08800 09200 09600 10300

martinholmer commented 8 years ago

Dan said:

As to the difference with Internet-TAXSIM, could one of you give me the 22 variables for one of the problem records and let me check out what Internet-TAXSIM does? I'd like to assure myself that it is right. Perhaps it isn't.

Dan, It would be very helpful to know both the Internet-TAXSIM and the taxcalc.sas results for this filing unit (in Internet-TAXSIM input format):

29224 2013 0 3 2 0 29000 0 2000 0 0 0 0 0 3600 400 9000 2000 2 0 3000 -1000

@feenberg @GoFroggyRun @MattHJensen @Amy-Xu

feenberg commented 8 years ago

On Tue, 5 Apr 2016, Martin Holmer wrote:

Dan said:

  As to the difference with Internet-TAXSIM, could one of you give me the 22
  variables for one of the problem records and let me check out what
  Internet-TAXSIM does? I'd like to assure myself that it is right. Perhaps
  it isn't.

Dan, It would be very helpful to know both the Internet-TAXSIM and taxcalc.sas results for this filing unit (in Internet-TAXSIM input format):

29224 2013 0 3 2 0 29000 0 2000 0 0 0 0 0 3600 400 9000 2000 2 0 3000 -1000

This person has 2 children, so the expenditure should be limited to 6,000 and indeed internet taxsim does do that. The credit is calculated as 1,235 which we believe to be correct. If taxcalc.sas doesn't get that result, can you try the version sent this morning?

dan

@feenberg @GoFroggyRun @MattHJensen @Amy-Xu

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub[AHvQVX1-CTyLDNDVUwoigKBE4gHRQ1yoks5p0mPUgaJpZM4H_J-a.gif]

feenberg commented 8 years ago

Also note that the regular tax is 1235, so that reduces the credit from 1500 to 1235.

dan

On Tue, 5 Apr 2016, Daniel Feenberg wrote:

On Tue, 5 Apr 2016, Martin Holmer wrote:

Dan said:

   As to the difference with Internet-TAXSIM, could one of you give me
   the 22
   variables for one of the problem records and let me check out what
   Internet-TAXSIM does? I'd like to assure myself that it is right.
   Perhaps
   it isn't.

Dan, It would be very helpful to know both the Internet-TAXSIM and taxcalc.sas results for this filing unit (in Internet-TAXSIM input format):

29224 2013 0 3 2 0 29000 0 2000 0 0 0 0 0 3600 400 9000 2000 2 0 3000 -1000

This person has 2 children, so the expenditure should be limited to 6,000 and indeed internet taxsim does do that. The credit is calculated as 1,235 which we believe to be correct. If taxcalc.sas doesn't get that result, can you try the version sent this morning?

dan

@feenberg @GoFroggyRun @MattHJensen @Amy-Xu

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub[AHvQVX1-CTyLDNDVUwoigKBE4gHRQ1yoks5p0mPUgaJpZM4H_J-a.gif]

martinholmer commented 8 years ago

Issue #675 has been resolved by the Tax-Calculator bug fix in pull request #677.

At some future date, we might consider adding the (not-available in the 2009 IRS-SOI PUF) e32700 variable to the childcare credit logic.