x cd /pub/data/irstaxes/Tools; %let pgm=cnvt_irstaxes2; filename pgm "&pgm..sas"; *----Convert the state/county level CSV files downloaded from the IRS site - http://www.irs.gov/uac/SOI-Tax-Stats-County-Data-Downloads We convert to SAS data sets using variable names and labels provided in the Word Doc for County Data Documentation Guide (copied to the irstaxes data directory: https://mcdc.missouri.edu/pub/data/irstaxes/11incydoc.doc). J. Blodgett, OSEDA, under contract with the Missouri Census Data Center. February, 2014. These data summarize individual tax returns by state and county & sometimes Adjusted Gross Income Group for a specified tax year. The returns reflect residence at the time of filing, typically in the spring of the following calendar year. So 2011 data are based mostly on returns submitted between Feb and April of 2012. See companion setup cnvt_irstaxes which handles comparable ZIP code level data. ----*; %let year=2011; *---Income tax year---; %let yr=%substr(&year,3,2); libname irstaxes '/pub/data/irstaxes'; *--This is where we create the data set(s)---; filename csvinall "/pub/data/irstaxes/&yr.incyallagi.csv"; filename csvinno "/pub/data/irstaxes/&yr.incynoagi.csv"; *<---we manually renamed this file (was "allnoagi" as downloaded)-; options compress=no; proc format; *--create a format code for use in assigning the AGI variable--; value $agi 0='0 Total' 1='1 Under $1' 2='2 $1 < $25k' 3='3 $25k < $50k' 4='4 $50k < $75k' 5='5 $75k < $100k' 6='6 $100k < $200k' 7='7 $200k or more'; run; %macro docntys(allno); %local setname; %let setname=uscntys&allno.agi&yr; data irstaxes.&setname (label="Income Tax data by ZIP Code for tax year &year &allno AGI Groups" ); length State Stab $2 _cnty $3 County $5 AreaName $18 agi_stub $1 agi $15 SumLev $3; retain TaxYear "&year"; Length N1 MARS2 PREP N2 NUMDEP A00100 N00200 A00200 N00300 A00300 N00600 A00600 N00650 A00650 N00900 A00900 SCHF N01000 A01000 N01400 A01400 N01700 A01700 N02300 A02300 N02500 A02500 N03300 A03300 N04470 A04470 N18425 A18425 N18450 A18450 N18500 A18500 N18300 A18300 N19300 A19300 N19700 A19700 N04800 A04800 N07100 A07100 N07220 A07220 N07180 A07180 N07260 A07260 N59660 A59660 N59720 A59720 N11070 A11070 N09600 A09600 N06500 A06500 N10300 A10300 N11901 A11901 N11902 A11902 5; Format A0: A1: A5: dollar12. n1 mars2 prep n2 numdep schf N0: N1: N5: comma9.; infile csvin&allno dsd missover firstobs=2 lrecl=2056; input state stab _cnty AreaName agi_stub n1--a11902; if _cnty ne '000' then do; County=state||_cnty; SumLev='050'; **AreaName=put(ZIPcode,$zipname.); end; else do; County='00000'; SumLev='040'; *--Standard code indicating a state level summary--; Areaname=put(state,$state.); end; agi=put(agi_stub,$agi.); drop _cnty; Label County="5-digit County Code " agi_stub="Size of Adj Gross Income" agi="Adj Gross Income Catgry" SumLev="Geo Summary Lvl Code" N1="# Returns " MARS2="# Joint Returns " PREP="# Returns w Paid Preparer Signature" N2="# exemptions [3] " NUMDEP="# dependents " A00100="AGI (Adj Gross Income" N00200="Returns w Salaries & Wages " A00200="Salaries & Wages Amt " N00300="Returns w Taxable Interest " A00300="Taxable Interest Amt " N00600="Returns w Ordinary Dividends " A00600="Ordinary Dividends Amt " N00650="Returns w Qualified Dividens " A00650="Qualified Dividends Amt " N00900="Returns w Business or Professional Net Income (less loss)" A00900="Bus or Prof Net Income Amt " SCHF="# Farm Returns " N01000="Returns w Capital Gain (less loss)" A01000="Capital Gain (less loss) Amt " N01400="Returns w IRA Distributions " A01400="IRA Distributions Amt " N01700="Returns w Taxable Pensions & Annuities " A01700="Taxable Pensions & Annuities Amt " N02300="Returns w Unemployment Compensation " A02300="Unemployment Compensation Amt " N02500="Returns w Taxable Social Security benefits " A02500="Taxable Social Security benefits amt " N03300="Returns w Self-employment Retirement Plans " A03300="Self-employment Retirement Plans Amt " N04470="Returns w Itemized Deductions" A04470="Itemized Deductions Amt" N18425="Returns w State & Local Income Tax" A18425="State & Local Income Taxes Amt " N18450="Returns w State & Local General Sales Tax" A18450="State & Local General Sales Tax Amt " N18500="Returns w Real Estate Taxes " A18500="Real Estates Taxes Amt " N18300="Returns w Taxes Paid" A18300="Taxes Paid Amt " ; LABEL N19300="Returns w Mortgage Interest Paid" A19300="Mortgage Interest Paid Amt" N19700="Returns w Contributions" A19700="Contributions Amt " N04800="Returns w Taxable Income" A04800="Taxable Income Amt" N07100="Returns w Total Tax Credits" A07100="Total Tax Credits Amt" N07220="Returns w Child tax credit" A07220="Child Tax Credit Amt" N07180="Returns w Child & Dependent Care Credit" A07180="Child & Dependent Care Credit Amt" N07260="Returns w Additional Child Tax Credit" A07260="Additional Child Tax Credit Amt" N59660="Returns w Earned Income Credit" A59660="Earned Income Credit Amt [6]" N59720="Returns w Excess Earned Income Credit" A59720="Excess Earned Income Credit (refundable) Amt [7]" N11070="Returns with additional child tax credit " A11070="Additional child tax credit Amt" N09600="Returns with alternative minimum tax " A09600="Alternative Minimum Tax Amt " N06500="Returns with income tax " A06500="Income Tax Amt [8] " N10300="Returns with tax liability " A10300="Total Tax Liability [9] " N11901="Returns with tax due at time of filing " A11901="Tax Due at Time of Filing Amt [10] " N11902="Returns with overpayments refunded " A11902="Overpayments Refunded Amt [11]" ; * ==============================Footnotes copied from the tech doc for 2011 release====================================== F. Endnotes: [1] For complete individual income tax tabulations at the State level, see the historic table posted to Tax Stats at http://www.irs.gov/uac/SOI-Tax-Stats---Historic-Table-2. [2] Values of 0.0001 indicate an AGI class that has been combined with another AGI class within the same county or moved to another county within the state, where applicable. [3] The County Federal Information Processing System (FIPS) codes used for these statistics were derived from the U.S. Census Bureau. A complete list of codes can be obtained from http://www.census.gov/popest/geographic/codes02.html. [4] Less deficit. [5] ?Qualified dividends? are ordinary dividends received in tax years beginning after 2002 that meet certain conditions and receive preferential tax rates. The maximum qualified dividends tax rate is 15%. [6] Includes the Alaskan permanent fund, reported by residents of Alaska on Forms 1040A and 1040EZ's. This fund only applies to statistics in the totals, and the state of Alaska. [7] Earned income credit includes both the refundable and non-refundable portions. The non-refundable portion could reduce income tax and certain related taxes to zero. The earned income credit amounts in excess of total tax liability, or amounts when there was no tax liability at all, were refundable. See footnote 8 below for explanation of the refundable portion of the earned income credit. [8] The refundable portion of the earned income credit equals total income tax minus the earned income credit. If the result is negative, this amount is considered the refundable portion. No other refundable credits were taken into account for this calculation. [9] Income tax reflects the amount reported on Form 1040 line 55. It also includes data from Form 1040A and 1040EZ filers. [10] ?Total tax liability? differs from ?Income tax?, in that ?Total tax liability? includes the taxes from recapture of certain prior-year credits, tax applicable to individual retirement arrangements (IRA's), social security taxes on self-employment income and on certain tip income, advanced earned income payments, household employment taxes, and certain other taxes listed in the Form 1040 instructions. [11] Reflects payments to or withholdings made to "Total tax liability". This is the amount the tax filer owes when the income tax return is filed. [12] The amount of overpayments the tax filer requested to have refunded. ===================================End Footnotes========================================================================= *; run; options ps=90 ls=160; title "Data Per irstaxes.&setname Data Set"; proc print data=irstaxes.&setname(obs=50); title2 "First 50"; by taxyear state stab; id county areaname agi; run; proc means data =irstaxes.&setname n mean sum max; title2 "proc means"; class sumlev agi; run; proc datasets library=irstaxes; modify &setname ; index create state; quit; proc sql; create view irstaxes.mocntys&allno.agi&yr as select * from irstaxes.&setname where state='29'; quit; %mend docntys; %docntys(all) ; %docntys(no);