x cd /pub/data/irstaxes/Tools; %let pgm=compare_irstaxes2; filename pgm "&pgm..sas"; *----See compare_irstaxes.sas for background. This does for county data what that setup did for ZIP data. It reads 2 CSV files (4 actually) and does proc compares to see if there are diffs. See companion setup compare_irstaxes which handles comparable ZIP code level data. Results: NO differences found!!! Excerpt from SAS log file: Number of Observations in Common: 22351. Total Number of Observations Read from IRSTAXES.USCNTYSALLAGI11VFEB18: 22351. Total Number of Observations Read from IRSTAXES.USCNTYSALLAGI11VAPR29: 22351. Number of Observations with Some Compared Variables Unequal: 0. Number of Observations with All Compared Variables Equal: 22351. NOTE: No unequal values were found. All values compared are exactly equal. NOTE: We renamed the APR29 sets created here to eliminate the suffix, and deleted the output compare sets and the VFEB18 sets. ----*; %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 csvinal1 "/pub/data/irstaxes/&yr.incyallagi.csv"; filename csvinal2 "/pub/data/irstaxes/&yr.incyallagi_apr30.csv"; filename csvinno1 "/pub/data/irstaxes/&yr.incynoagi.csv"; *--Had to rename this one. It came down as "allnoagi" (?)--; filename csvinno2 "/pub/data/irstaxes/&yr.incynoagi_apr29.csv"; *--Later download--; 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,fileno); %if &fileno=1 %then %let asof=feb18; %else %let asof=apr29; %local setname; %let setname=uscntys&allno.agi&yr.v&asof; 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.; %let allno2=%substr(&allno,1,2); %*--just 2 characters---; infile csvin&allno2&fileno 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]" ; run; %mend docntys; %docntys(no,1); %docntys(no,2); proc compare base=irstaxes.uscntysnoagi11vfeb18 compare=irstaxes.uscntysnoagi11vapr29 nodate out=irstaxes.compare_outcnty1(drop=_type_ stab agi_stub agi sumlev taxyear) listequalvar; ID state county areaname; run; %docntys(all,1) ; %docntys(all,2) ; proc compare base=irstaxes.uscntysallagi11vfeb18 compare=irstaxes.uscntysallagi11vapr29 nodate out=irstaxes.compare_outcnty2(drop=_type_ stab agi sumlev taxyear) listequalvar; ID state county areaname agi; run;