x cd /pub/data/irstaxes/Tools; %let pgm=invoke_dosets_20xx; filename pgm "&pgm..sas";
/*
Invoke the %doset macro to create observations in the Datasets dataset for this directory.
*/
%include "/pub/sas/autoexec.sas";
title "Job to invoke doset macro for sets in irstaxes, creating irstaxes.datasets";
libname irstaxes '/data/irstaxes';
%let libnameg = irstaxes;
%let todo = ;
* Run this step ONLY ONCE. If you need to rerun (start over), 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 = 2021;
%let yr = %substr(&year, 3, 2);
* Original dataset with IRS var names ;
%doset(
mode=,
libname=irstaxes,
memname=returns&yr,
geouniv=US,
units=%str(state county ZIP),
Years=&year,
CreatePgm=cnvt_irstaxes_&year,
Keywords=&year IRS tax returns ZIP county income,
Description=%nrbquote(Summary of tax returns for &year at state, county, and ZIP levels),
keyvars=sumlev state agi_stub,
keyfmats=%str(sumlev state | ),
keyIdvars=%str( | | agi),
DataSource=%str(Internal Revenue Service, SOI Division),
SortedBy=sumlev state geoid agi_stub,
UsageNotes=%nrbquote(
- Most observations summarize one Adjusted Gross Income (AGI) interval for a state, county, or ZIP code based on almost all tax returns for year &year.
- The dataset also includes observations summarizing all returns regardless of the AGI class. These have an agi_stub value of 0.
- Filter on sumlev = 040 for states, 050 for counties, or 861 for ZIP codes.
- The five-character geoid variable contains either the county FIPS code (or state if it ends with "000") or the ZIP code.
- All geographies are within states, so a state = [FIPS] filter also works to select one or more individual states.
- Note that the AGI variable contains the one-digit stub code followed by the description of the AGI dollar interval.
- Variable names mostly conform to those used in the documentation. A key exception is State, which is the FIPS code, while Stab contains the postal abbreviation. We added AreaName.
- See the IRS SOI Tax Stats page for background info and other related data.
),
SetGroup=us,
VarSet=,
URLMeta=%str(https://mcdc.missouri.edu/data/irstaxes/&yr.incydocguide.docx),
debug=0
);
* Enhanced ("plus") dataset ;
%doset(
mode=,
libname=irstaxes,
memname=returnsplus&yr,
geouniv=US,
units=%str(state county ZIP),
Years=&year,
CreatePgm=cnvt_irstaxes_&year,
Keywords=&year IRS tax returns ZIP county income,
Description=%nrbquote(Enhanced summary of tax returns for &year at state, county, and ZIP levels),
keyvars=sumlev state agi_stub,
keyfmats=%str(sumlev state | ),
keyIdvars=%str( | | agi),
DataSource=%str(Internal Revenue Service, SOI Division),
SortedBy=sumlev state geoid agi_stub,
UsageNotes=%nrbquote(
- This enhanced version has mnemonic variable names plus averages and percentages.
- Most observations summarize one Adjusted Gross Income (AGI) interval for a state, county, or ZIP code based on almost all tax returns for year &year.
- All total dollar amount variables (those that begin with "amt") are in thousands of dollars, while all the corresponding average values are in simple dollars.
- Filter on sumlev = 040 for states, 050 for counties, or 861 for ZIP codes.
- The five-character geoid variable contains either the county FIPS code (or state if it ends with "000") or the ZIP code.
- All geographies are within states, so a state = [FIPS] filter also works to select one or more individual states.
- The dataset also includes observations summarizing all returns regardless of the AGI class. These have an agi_stub value of 0.
- The AGI variable contains the one-digit "stub" code followed by the description of the AGI dollar interval.
- See the IRS SOI Tax Stats page for background info and other related data.
),
SetGroup=us,
sortprio=1,
VarSet=,
URLMeta=%str(https://mcdc.missouri.edu/data/irstaxes/&yr.incydocguide.docx),
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);