x cd /pub/data/irstaxes/Tools; %let pgm=invoke_dosetsYY; filename pgm "&pgm..sas";
/*--Invoke the %doset macro to create observations in the Datasets dataset for this directory.
*<==== We just do the original collection of sets in this setup. We do the "plus" datasets in invoke_dosets_plus.sas .
Only works starting with 2012. Note we do BOTH the original & "plus" data sets in this one run, making invoke_dosets_plus obsolete.
=======================================================================================================================
J. Blodgett, OSEDA,
Updated Aug, 2014.
Run w 2014 additions Sept 2016
-- */
title "Job to Invoke doset Macro for Sets in irstaxes, creating irstaxes.datasets";
libname irstaxes '/pub/data/irstaxes';
%let libnameg=irstaxes;
%let todo=;
*-----Run this step ONLY ONCE------------------------------------------;
*----If you need to rerun (start over) then delete the datasets dataset first. doset will not
allow initialize mode if the datasets set already exists.---;
%**doset(mode=initialize,
libname=irstaxes,debug=1);
%*let year=2012;
%let year=2014;
%let yr=%substr(&year,3,2);
*----------------------------------------------------------------------;
*----------------------------Do all the "not plus" original data sets with IRS var names (4 per year)-----------------;
*---We do zipsall, zipsno, cntyall, cntyno--*;
%doset(mode=,libname=irstaxes,
memname=uszipsallagi&yr,
geouniv=US,
units=%str(state ZIP),
Years=&year,
CreatePgm=cnvt_irstaxes&yr,
Keywords=&year IRS tax returns ZIP codes income,
Description=%nrbquote(Summary of tax returns for &year at ZIP and State levels w AGI interval detail),
keyvars=sumlev state agi_stub,
keyfmats=%str(sumlev state | ),
keyIdvars=%str( | | agi),
DataSource=%str(Internal Revenue Service, SOI Division),
SortedBy=State SumLev ZIPcode agi_stub,
UsageNotes=%nrbquote(
- Most observations summarize 1 Adjusted Gross Income interval (agi) for a ZIP code
based on (almost - see techdoc) all tax returns for year &year . When ZIP is
00000 then SumLev will have a
value of 040 and the data are a state-level summary (for the specified AGI).
- Note that the agi variable contains the 1-digit stub code followed by the description of the AGI dollar interval.
- Note footnote 2 in the tech doc re use of .0001 value to indicate a value that may have been combined with another AGI class
or reported in a 99999 group. When the N variable is .0001 the value of the A variable will be the same.
- Variable names mostly conform to those used in the zpdoc.doc file. A key exception is State (which is the FIPS code
for us while Stab contains the postal abbreviation.) We added AreaName.
- A companion data set summarizes all returns regardless of the AGI class (replace "allagi" with "noagi" in set name).
- See http://www.irs.gov/uac/Tax-Stats-2 for background info and other related data.
),
SubType=zip2allagi,
SetGroup=us,
VarSet=,
URLMeta=%str(https://mcdc.missouri.edu/pub/data/irstaxes/&yr.zpdoc.doc),
debug=0);
%doset(mode=,libname=irstaxes,
memname=uszipsnoagi&yr,
geouniv=US,
units=%str(state ZIP),
Years=&year,
CreatePgm=cnvt_irstaxes&yr,
Keywords=&year IRS tax returns ZIP codes income,
Description=%nrbquote(Summary of tax returns for &year at ZIP and State levels - NO AGI interval detail),
keyvars=sumlev state,
keyfmats=%str(sumlev state ),
DataSource=%str(Internal Revenue Service, SOI Division),
SortedBy=State SumLev ZIPcode ,
UsageNotes=%nrbquote(- Most observations summarize a ZIP code
based on (almost - see techdoc) all tax returns for year &year . When ZIP is
00000 then SumLev will have a
value of 040 and the data are a state-level summary.
- Variable names mostly conform to those used in the zpdoc.doc file. A key exception is State (which is the FIPS code
for us while Stab contains the postal abbreviation.) We added AreaName.
- Note footnote 2 in the tech doc re use of .0001 value to indicate a value that may have been combined with another AGI class
or reported in a 99999 group. When the N variable is .0001 the value of the A variable will be the same.
- A companion data set summarizes returns within 6 AGI classes (replace "noagi" with "allagi" in set name).
- See http://www.irs.gov/uac/Tax-Stats-2 for background info and other related data.
),
SubType=zip2noagi,
SetGroup=us,
VarSet=,
URLMeta=%str(https://mcdc.missouri.edu/pub/data/irstaxes/&yr.zpdoc.doc),
debug=0);
*==============================End of ZIP sets, begin county sets====================================================*;
%doset(mode=,libname=irstaxes,
memname=uscntysallagi&yr,
geouniv=US,
units=%str(state County),
Years=&year,
CreatePgm=cnvt_irstaxes&yr,
Keywords=&year IRS tax returns County codes income,
Description=%nrbquote(Summary of tax returns for &year at County and State levels w AGI interval detail),
keyvars=sumlev state agi_stub,
keyfmats=%str(sumlev state | ),
keyIdvars=%str( | | agi),
DataSource=%str(Internal Revenue Service, SOI Division),
SortedBy=State SumLev County agi_stub,
UsageNotes=%nrbquote(- Most observations summarize 1 Adjusted Gross Income interval (agi) for a County code
based on (almost - see techdoc) all tax returns for year &year . When County is
00000 then SumLev will have a
value of 040 and the data are a state-level summary (for the specified AGI).
- Note footnote 2 in the tech doc re use of .0001 value to indicate a value that may have been combined with another AGI class
or reported in a 99999 group. When the N variable is .0001 the value of the A variable will be the same.
- Note that the agi variable contains the 1-digit code followed by the description of the AGI dollar interval.
- Variable names mostly conform to those used in the &yr.incydoc.doc file. A key exception is State (which is the FIPS code
for us while Stab contains the postal abbreviation.)
- A companion data set summarizes all returns regardless of the AGI class (replace "allagi" with "noagi" in set name).
- See http://www.irs.gov/uac/Tax-Stats-2 for background info and other related data.
),
SubType=cnty2allagi,
SetGroup=us,
VarSet=,
URLMeta=%str(https://mcdc.missouri.edu/pub/data/irstaxes/&yr.incydoc.doc),
debug=0);
%doset(mode=,libname=irstaxes,
memname=uscntysnoagi&yr,
geouniv=US,
units=%str(state County),
Years=&year,
CreatePgm=cnvt_irstaxes&yr,
Keywords=&year IRS tax returns County codes income,
Description=%nrbquote(Summary of tax returns for &year at County and State levels - NO AGI interval detail),
keyvars=sumlev state,
keyfmats=%str(sumlev state ),
DataSource=%str(Internal Revenue Service, SOI Division),
SortedBy=State SumLev County ,
UsageNotes=%nrbquote(- Most observations summarize a county
based on (almost - see techdoc) all tax returns for year &year . When County is
00000 then SumLev will have a
value of 040 and the data are a state-level summary.
- Note footnote 2 in the tech doc re use of .0001 value to indicate a value that may have been combined with another AGI class
or reported in a 99999 group. When the N variable is .0001 the value of the A variable will be the same.
- Variable names mostly conform to those used in the &yr.incydoc.doc file. A key exception is State (which is the FIPS code
for us while Stab contains the postal abbreviation.)
- A companion data set summarizes returns within 7 AGI classes (replace "noagi" with "allagi" in set name).
The AGI classes changed between tax years 2011 and 2012.
- See http://www.irs.gov/uac/Tax-Stats-2 for background info and other related data.
),
SubType=cnty2noagi,
SetGroup=us,
VarSet=,
URLMeta=%str(https://mcdc.missouri.edu/pub/data/irstaxes/&yr.incydoc.doc),
debug=0);
*--------------------------- Now do all the "plus" data sets (4 per year) with our enhancements-----------------;
*---We do zipsall, zipsno, cntyall, cntyno--*;
%doset(mode=,libname=irstaxes,
memname=uszipsplusallagi&yr,
geouniv=US,
units=%str(state ZIP),
Years=&year,
CreatePgm=cnvt_irstaxes_&year,
Keywords=&year IRS tax returns ZIP codes income,
Description=%nrbquote(This enhanced Summary of tax returns for &year at ZIP and State levels w AGI interval detail),
keyvars=sumlev state agi_stub,
keyfmats=%str(sumlev state | ),
keyIdvars=%str( | | agi),
DataSource=%str(Internal Revenue Service, SOI Division),
SortedBy=State SumLev ZIPcode agi_stub,
UsageNotes=%nrbquote(- This enhanced version has mnemonic variable names plus averages and percentages.
- Most observations summarize 1 Adjusted Gross Income interval (agi) for a ZIP code
based on (almost - see techdoc) all tax returns for year &year . When ZIP is
00000 then SumLev will have a
value of 040 and the data are a state-level summary (for the specified AGI).
- Note that the agi variable contains the 1-digit code followed by the description of the AGI dollar interval.
- Per footnote 2 in tech doc some variables were assigned values of .0001 to indicate not being reported. We have edited
these values to 0. In an earlier conversion we did not do this and it cause Avg variables to have values of 1000.
- Variable names mostly conform to those used in the &yr.zpdoc.doc file. A key exception is State (which is the FIPS code
for us while Stab contains the postal abbreviation.) We added AreaName.
- All total dollar amount variables (those that begin
amt) are in thousands of dollars, while all the
corresponding average values are in simple dollars.
- A companion data set summarizes all returns regardless of the AGI class (replace "allagi" with "noagi" in set name).
- See http://www.irs.gov/uac/Tax-Stats-2 for background info and other related data.
),
SubType=zip1allagi,
SetGroup=us, sortprio=1,
VarSet=,
URLMeta=%str(https://mcdc.missouri.edu/pub/data/irstaxes/&yr.zpdoc.doc),
debug=0);
%doset(mode=,libname=irstaxes,
memname=uszipsplusnoagi&yr,
geouniv=US,
units=%str(state ZIP),
Years=&year,
CreatePgm=cnvt_irstaxes_&year,
Keywords=&year IRS tax returns ZIP codes income,
Description=%nrbquote(This enhanced Summary of tax returns for &year at ZIP and State levels - NO AGI interval detail),
keyvars=sumlev state,
keyfmats=%str(sumlev state ),
DataSource=%str(Internal Revenue Service, SOI Division),
SortedBy=State SumLev ZIPcode ,
UsageNotes=%nrbquote(- This enhanced version has mnemonic variable names plus averages and percentages.
- Most observations summarize a ZIP code
based on (almost - see techdoc) all tax returns for year &year . When ZIP is
00000 then SumLev will have a
value of 040 and the data are a state-level summary.
- Per footnote 2 in tech doc some variables were assigned values of .0001 to indicate not being reported. We have edited
these values to 0. In an earlier conversion we did not do this and it cause Avg variables to have values of 1000.
- Variable names mostly conform to those used in the zpdoc.doc file. A key exception is State (which is the FIPS code
for us while Stab contains the postal abbreviation.) We added AreaName.
- All total dollar amount variables (those that begin
amt) are in thousands of dollars, while all the
corresponding average values are in simple dollars.
- A companion data set summarizes returns within 6 AGI classes (replace "noagi" with "allagi" in set name).
- See http://www.irs.gov/uac/Tax-Stats-2 for background info and other related data.
- Data set had to be regenerated after errors were discovered in original downloaded files. Fix made 4-30-14.
),
SubType=zip1noagi,
SetGroup=us,Sortprio=1,
VarSet=,
URLMeta=%str(https://mcdc.missouri.edu/pub/data/irstaxes/&yr.zpdoc.doc),
debug=0);
*==============================End of ZIP sets, begin county sets====================================================*;
%doset(mode=,libname=irstaxes,
memname=uscntysplusallagi&yr,
geouniv=US,
units=%str(state County),
Years=&year,
CreatePgm=cnvt_irstaxes_&year,
Keywords=&year IRS tax returns County codes income,
Description=%nrbquote(This enhanced Summary of tax returns for &year at County and State levels w AGI interval detail),
keyvars=sumlev state agi_stub,
keyfmats=%str(sumlev state | ),
keyIdvars=%str( | | agi),
DataSource=%str(Internal Revenue Service, SOI Division),
SortedBy=State SumLev County agi_stub,
UsageNotes=%nrbquote(- This enhanced version has mnemonic variable names plus averages and percentages.
- Most observations summarize 1 Adjusted Gross Income interval (agi) for a County code
based on (almost - see techdoc) all tax returns for year &year . When County is
00000 then SumLev will have a
value of 040 and the data are a state-level summary (for the specified AGI).
- Note that the agi variable contains the 1-digit code followed by the description of the AGI dollar interval.
The agi values changed between tax years 2011 and 2012.
- Per footnote 2 in tech doc some variables were assigned values of .0001 to indicate not being reported. We have edited
these values to 0. In an earlier conversion we did not do this and it cause Avg variables to have values of 1000.
- Variable names mostly conform to those used in the &yr.incydocguide.doc file. A key exception is State (which is the FIPS code
for us while Stab contains the postal abbreviation.)
- All total dollar amount variables (those that begin
amt) are in thousands of dollars, while all the
corresponding average values are in simple dollars.
- A companion data set summarizes all returns regardless of the AGI class (replace "allagi" with "noagi" in set name).
- See http://www.irs.gov/uac/Tax-Stats-2 for background info and other related data.
),
SubType=cnty1allagi,
SetGroup=us,Sortprio=1,
VarSet=,
URLMeta=%str(https://mcdc.missouri.edu/pub/data/irstaxes/&yr.incydocguide.doc),
debug=0);
%doset(mode=,libname=irstaxes,
memname=uscntysplusnoagi&yr,
geouniv=US,
units=%str(state County),
Years=&year,
CreatePgm=cnvt_irstaxes_&year,
Keywords=&year IRS tax returns County codes income,
Description=%nrbquote(This enhanced Summary of tax returns for &year at County and State levels - NO AGI interval detail),
keyvars=sumlev state,
keyfmats=%str(sumlev state ),
DataSource=%str(Internal Revenue Service, SOI Division),
SortedBy=State SumLev County ,
UsageNotes=%nrbquote(- This enhanced version has mnemonic variable names plus averages and percentages.
- Most observations summarize a county
based on (almost - see techdoc) all tax returns for year &year . When County is
00000 then SumLev will have a
value of 040 and the data are a state-level summary.
- Variable names mostly conform to those used in the &yr.incydocguide.doc file. A key exception is State (which is the FIPS code
- Per footnote 2 in tech doc some variables were assigned values of .0001 to indicate not being reported. We have edited
these values to 0. In an earlier conversion we did not do this and it cause Avg variables to have values of 1000.
for us while Stab contains the postal abbreviation.)
- All total dollar amount variables (those that begin
amt) are in thousands of dollars, while all the
corresponding average values are in simple dollars.
- A companion data set summarizes returns within 6 AGI classes (replace "noagi" with "allagi" in set name).
- See http://www.irs.gov/uac/Tax-Stats-2 for background info and other related data.
),
SubType=cnty1noagi,
SetGroup=us,Sortprio=1,
VarSet=,
URLMeta=%str(https://mcdc.missouri.edu/pub/data/irstaxes/&yr.incydocguide.doc),
debug=0);
proc sort data=irstaxes.datasets out=bysortprio; by sortprio; run;
proc print data=bysortprio;
by libname notsorted libpath ;
id memname;
var SortPrio SetGroup SubType VarSet URLmeta GeoUniv years ;
title2 'Listing of Selected Fields from irstaxes.datasets (Sorted by SortPrio)';
run ;
proc datasets library=irstaxes nolist;
modify datasets;
index delete dataset memname;
index create dataset=(libname memname) / unique;
index create memname;
quit;
options NOmprint msglevel=i;
%gendshtm(libname=irstaxes,debug=0,runprocc=1);