x cd /pub/data/irsmig/Tools; %let pgm=invoke_dosets; filename pgm "&pgm..sas";
libname irsmig '/pub/data/irsmig';
%***doset(mode=initialize, libname=irsmig,memname=moinmigty2000,debug=1);
*---running 1-16 to document the 1314 data sets created previous Oct0ber---;
*--run 10-17-16 to capture newly added 14-15 data--;
*--run 01-30-2020 to capture several years of newly added data--;
*--run 5/27/2021 to capture new 18-19 data--;
%let todolist=;
%include '/pub/sas/autoexec.sas';
/*<=========================Comment out=====================================
*---Create custom SAS format codes for these datasets. These are compiled into the library.formats catalog
but are not saved in source form in the /pub/sas/formats directory. ---;
proc format library=library;
value $irssuml '040'='State' '050'='County'
'ods'='Other, different state' 'oss'='Other, same state' 'ore'='Other, U.S. Region'
'tds'='Total, different state' 'tfo'='Total Foreign' 'tot'='Total (Foreign + Domestic)' 'tus'='Total Domestic'
'tss'='Total, same state';
value $irscoun '96000'='Total Foreign & Domestic' '97000'='Total Domestic' '98000','57009'='Total Foreign'
'57005'='Total Foreign - APO/FPO ZIPs'
'97001'='Total Same State' '97003'='Total Different State'
'58000'='Other Flows - Same State'
'59001'='Other Flows - Northeast' '59003'='Other Flows - Midwest' '59005'='Other Flows - South'
'59007'='Other Flows - West'
other=[$county];
run;
*----Create the template entry for the inmigration datasets---;
%doset(memname=_template_inmo,libname=irsmig,
memlabel=Missouri inmigration data based on tax returns filed in ~year1 and ~year2,
geouniv=Missouri,
units=counties by various levels,
Years=~year2,
CreatePgm=cnvt_irsmig,
Keywords=population migration immigration irs county adjusted gross income tax returns exemptions,
Description=%nrbquote(Special tabulation from the IRS summarizing tax returns in Missouri in ~year2 that were matched to
a return for ~year1.. This permits generating a summary based on the From geography of the earlier year. E.g. we can say how
many returns in Boone county in ~year2 were matched to returns in St. Louis county in ~year1 . The variable ToSumLev indicates the
level of geography for the later year, while FromSumLev indicates the level for the earlier year. ToSumLev is almost always 050, meaning
county level, while FromSumLev has many different values. The data on
total exemptions reported on these returns and total adjusted gross income serve as proxies for total population and
various income measures.),
keyvars=ToState ToCounty ToSumLev FromState FromCounty FromSumLev,
keyfmats=state county sumlev state irscoun irssuml,
DataSource=%str(Internal Revenue Service),
SortedBy=,
UsageNotes=%nrbquote(
- All years pertain to the year the return was filed. So 2007 refers to tax year 2006, etc.
- The companion dataset, mooutmig~_years, has data summarizing returns that
were filed in Missouri in the previous year, allowing analysis of outmigrants between ~year1 and ~year2.
- Geographic ID variables all begin with "To" or "From" to indicate which side of the flow they describe. So a row with
ToCounty having a value of 29183 while FromCounty has a value of 29189 would be describing characteristics of persons who
moved from county 29189 (St. Louis county) to county 29183 (St. Charles, MO).
-
All income figures are based on the IRS adjusted gross income (AGI) figures and are not compatiable with other standard income
measures such as used by the Census Bureau or BEA. "Per capita" income is the average AGI per exemption. All income figures are
as reported in that tax year and have not been adjusted for inflation.
- Where the total number of "flows" (in or out, depending on the data set) between counties is less than 10 no detail is
reported at that level but it will be included in higher level "Other..." summaries such as "Other same state" or "Other Midwest".
- The Geographic Universe (Missouri) applies to the "in" (or "to") side of the migration flow only.
The "from" geography can be anywhere in the U.S. or from abroad.
),
URLmeta=%str(http://www.irs.gov/pub/irs-soi/05gross.pdf),
Means =MedianIncome AvgHHIncome PerCapitaIncome,
Mweights=NReturns NReturns NExemptions,
SubType=in,
SetGroup=mo,
debug=1)
%doset(memname=_template_inus,libname=irsmig,
memlabel=US inmigration data based on tax returns files in years ~year1 and ~year2,
geouniv=United States,
units=counties by various levels,
Years=~year2,
CreatePgm=cnvt_irsmig,
Keywords=population migration immigration irs county adjusted gross income tax returns exemptions,
Description=%nrbquote(Special tabulation from the IRS summarizing tax returns in the U.S. filed in ~year2 (for tax year ~year1)
that were matched to
a return filed in ~year1.. This permits generating a summary based on the From geography of the earlier year. E.g. we can say how
many returns in Boone county, MO in ~year2 were matched to returns in St. Louis county in ~year1 . The variable ToSumLev indicates the
level of geography for the later year, while FromSumLev indicates the level for the earlier year. ToSumLev is almost always 050, meaning
county level, while FromSumLev has many different values. The data on
total exemptions reported on these returns and total adjusted gross income serve as proxies for total population and
various income measures.),
keyvars=ToState ToCounty ToSumLev FromState FromCounty FromSumLev,
keyfmats=state county sumlev state irscoun irssuml,
DataSource=%str(Internal Revenue Service),
SortedBy=,
UsageNotes=%nrbquote(- The companion dataset, usoutmig~_years, has data summarizing returns that
were filed in the U.S. in the previous tax year, allowing analysis of outmigrants between ~year1 and ~year2.
- Geographic ID variables all begin with "To" or "From" to indicate which side of the flow they describe. So a row with
ToCounty having a value of 29183 while FromCounty has a value of 29189 would be describing characteristics of persons who
moved from county 29189 (St. Louis county) to county 29183 (St. Charles, MO).
-
All income figures are based on the IRS adjusted gross income (AGI) figures and are not compatiable with other standard income
measures such as used by the Census Bureau or BEA. "Per capita" income is the average AGI per exemption. All income figures are
as reported in that tax year and have not been adjusted for inflation.
- Where the total number of "flows" (in or out, depending on the data set) between counties is less than 10 no detail is
reported at that level but it will be included in higher level "Other..." summaries such as "Other same state" or "Other Midwest".
),
URLmeta=%str(http://www.irs.gov/pub/irs-soi/05gross.pdf),
Means =MedianIncome AvgHHIncome PerCapitaIncome,
Mweights=NReturns NReturns NExemptions,
SubType=in,
SetGroup=us,
debug=1)
*----Create the template entry for the outmigration datasets---;
%doset(memname=_template_outmo,libname=irsmig,
memlabel=Missouri outmigration data based on tax returns filed in years ~year1 and ~year2,
geouniv=Missouri,
units=counties by various levels,
Years=~_years,
CreatePgm=cnvt_irsmig,
Keywords=population migration immigration irs county adjusted gross income tax returns exemptions,
Description=%nrbquote(Special tabulation from the IRS summarizing tax returns in Missouri filed in ~year1 that were matched to
a return filed in ~year2.. This permits generating a summary based on the To geography of the later year. E.g. we can say how
many returns in Boone county in ~year1 were matched to returns in St. Louis county in ~year2 . The variable ToSumLev indicates the
level of geography for the later year, while FromSumLev indicates the level for the earlier year.
FromSumLev is almost always 050, meaning
county level, while ToSumLev has many different values. The data on
total exemptions reported on these returns and total adjusted gross income serve as proxies for total population and
various income measures.),
keyvars= FromState FromCounty FromSumLev ToState ToCounty ToSumLev ,
keyfmats=state county sumlev state irscoun irssuml,
DataSource=%str(Internal Revenue Service),
SortedBy=,
UsageNotes=%nrbquote(- The companion dataset, moinmig~_years, has data summarizing returns that
were filed in Missouri in the later tax year (~year2), allowing analysis of inmigrants between ~year1 and ~year2.
- Geographic ID variables all begin with "To" or "From" to indicate which side of the flow they describe. So a row with
ToCounty having a value of 29183 while FromCounty has a value of 29189 would be describing characteristics of persons who
moved from county 29189 (St. Louis county) to county 29183 (St. Charles, MO).
-
All income figures are based on the IRS adjusted gross income (AGI) figures and are not compatiable with other standard income
measures such as used by the Census Bureau or BEA. "Per capita" income is the average AGI per exemption.
All income figures areas reported in that tax year and have not been adjusted for inflation.
- Where the total number of "flows" (in or out, depending on the data set) between counties is less than 10 no detail is
reported at that level but it will be included in higher level "Other..." summaries such as "Other same state" or "Other Midwest".
- The Geographic Universe (Missouri) applies to the "out" (or "from") side of the migration flow only.
The "to" geography can be anywhere in the U.S. or from abroad.
),
Means =MedianIncome AvgHHIncome PerCapitaIncome,
Mweights=NReturns NReturns NExemptions,
URLmeta=%str(http://www.irs.gov/pub/irs-soi/05gross.pdf),
SubType=out,
SetGroup=mo,
debug=1)
%doset(memname=_template_outus,libname=irsmig,
memlabel=United States outmigration data based on tax returns filed in year~year1 and ~year2,
geouniv=United States,
units=counties by various levels,
Years=~_years,
CreatePgm=cnvt_irsmig,
Keywords=population migration immigration irs county adjusted gross income tax returns exemptions,
Description=%nrbquote(Special tabulation from the IRS summarizing tax returns in the U.S. in ~year1 that were matched to
a return for ~year2.. This permits generating a summary based on the To geography of the later year. E.g. we can say how
many returns in Boone county, MO in ~year1 were matched to returns in St. Louis county in ~year2 . The variable ToSumLev indicates the
level of geography for the later year, while FromSumLev indicates the level for the earlier year.
FromSumLev is almost always 050, meaning
county level, while ToSumLev has many different values. The data on
total exemptions reported on these returns and total adjusted gross income serve as proxies for total population and
various income measures.),
keyvars= FromState FromCounty FromSumLev ToState ToCounty ToSumLev ,
keyfmats=state county sumlev state irscoun irssuml,
DataSource=%str(Internal Revenue Service),
SortedBy=,
UsageNotes=%nrbquote(- The companion dataset, usinmig~_years, has data summarizing returns that
were filed in the later tax year (~year2), allowing analysis of inmigrants between ~year1 and ~year2.
- Geographic ID variables all begin with "To" or "From" to indicate which side of the flow they describe. So a row with
ToCounty having a value of 29183 while FromCounty has a value of 29189 would be describing characteristics of persons who
moved from county 29189 (St. Louis county) to county 29183 (St. Charles, MO).
-
All income figures are based on the IRS adjusted gross income (AGI) figures and are not compatiable with other standard income
measures such as used by the Census Bureau or BEA. "Per capita" income is the average AGI per exemption.
All income figures areas reported in that tax year and have not been adjusted for inflation.
- Where the total number of "flows" (in or out, depending on the data set) between counties is less than 10 no detail is
reported at that level but it will be included in higher level "Other..." summaries such as "Other same state" or "Other Midwest".
),
Means =MedianIncome AvgHHIncome PerCapitaIncome,
Mweights=NReturns NReturns NExemptions,
URLmeta=%str(http://www.irs.gov/pub/irs-soi/05gross.pdf),
SubType=out,
SetGroup=us,
debug=1)
%let year1=1999; %let year2=2000; %let _years=9900;
%doset(libname=irsmig,memname=moinmig&_years,template=_template_inmo)
%doset(libname=irsmig,memname=mooutmig&_years,template=_template_outmo)
%doset(libname=irsmig,memname=usinmig&_years,template=_template_inus)
%doset(libname=irsmig,memname=usoutmig&_years,template=_template_outus)
;
options NOmprint;
%let year1=2000; %let year2=2001; %let _years=0001;
%doset(libname=irsmig,memname=moinmig&_years,template=_template_inmo)
%doset(libname=irsmig,memname=mooutmig&_years,template=_template_outmo)
%doset(libname=irsmig,memname=usinmig&_years,template=_template_inus)
%doset(libname=irsmig,memname=usoutmig&_years,template=_template_outus)
%let year1=2001; %let year2=2002; %let _years=0102;
%doset(libname=irsmig,memname=moinmig&_years,template=_template_inmo)
%doset(libname=irsmig,memname=mooutmig&_years,template=_template_outmo)
%doset(libname=irsmig,memname=usinmig&_years,template=_template_inus)
%doset(libname=irsmig,memname=usoutmig&_years,template=_template_outus)
%let year1=2002; %let year2=2003; %let _years=0203;
%doset(libname=irsmig,memname=moinmig&_years,template=_template_inmo)
%doset(libname=irsmig,memname=mooutmig&_years,template=_template_outmo)
%doset(libname=irsmig,memname=usinmig&_years,template=_template_inus)
%doset(libname=irsmig,memname=usoutmig&_years,template=_template_outus)
%let year1=2003; %let year2=2004; %let _years=0304;
%doset(libname=irsmig,memname=moinmig&_years,template=_template_inmo)
%doset(libname=irsmig,memname=mooutmig&_years,template=_template_outmo)
%doset(libname=irsmig,memname=usinmig&_years,template=_template_inus)
%doset(libname=irsmig,memname=usoutmig&_years,template=_template_outus)
%let year1=2004; %let year2=2005; %let _years=0405;
%doset(libname=irsmig,memname=moinmig&_years,template=_template_inmo)
%doset(libname=irsmig,memname=mooutmig&_years,template=_template_outmo)
%doset(libname=irsmig,memname=usinmig&_years,template=_template_inus)
%doset(libname=irsmig,memname=usoutmig&_years,template=_template_outus)
%let year1=2005; %let year2=2006; %let _years=0506;
%doset(libname=irsmig,memname=moinmig&_years,template=_template_inmo,
Usagenotes=%nrbquote(+- The median adjusted gross income figures were not reported for these tax years by the IRS
))
%doset(libname=irsmig,memname=mooutmig&_years,template=_template_outmo,
Usagenotes=%nrbquote(+- The median adjusted gross income figures were not reported for these tax years by the IRS
))
%doset(libname=irsmig,memname=usinmig&_years,template=_template_inus,
Usagenotes=%nrbquote(+- The median adjusted gross income figures were not reported for these tax years by the IRS
))
%doset(libname=irsmig,memname=usoutmig&_years,template=_template_outus,
Usagenotes=%nrbquote(+- The median adjusted gross income figures were not reported for these tax years by the IRS
))
%let year1=2006; %let year2=2007; %let _years=0607;
%doset(libname=irsmig,memname=moinmig&_years,template=_template_inmo,
Usagenotes=%nrbquote(+- The median adjusted gross income figures were not reported for these tax years by the IRS
))
%doset(libname=irsmig,memname=mooutmig&_years,template=_template_outmo,
Usagenotes=%nrbquote(+- The median adjusted gross income figures were not reported for these tax years by the IRS
))
%doset(libname=irsmig,memname=usinmig&_years,template=_template_inus,
Usagenotes=%nrbquote(+- The median adjusted gross income figures were not reported for these tax years by the IRS
))
%doset(libname=irsmig,memname=usoutmig&_years,template=_template_outus,
Usagenotes=%nrbquote(+- The median adjusted gross income figures were not reported for these tax years by the IRS
))
%let year1=2007; %let year2=2008; %let _years=0708;
%doset(libname=irsmig,memname=moinmig&_years,template=_template_inmo,
Usagenotes=%nrbquote(+- The median adjusted gross income figures were not reported for these tax years by the IRS
))
%doset(libname=irsmig,memname=mooutmig&_years,template=_template_outmo,
Usagenotes=%nrbquote(+- The median adjusted gross income figures were not reported for these tax years by the IRS
))
%doset(libname=irsmig,memname=usinmig&_years,template=_template_inus,
Usagenotes=%nrbquote(+- The median adjusted gross income figures were not reported for these tax years by the IRS
))
%doset(libname=irsmig,memname=usoutmig&_years,template=_template_outus,
Usagenotes=%nrbquote(+- The median adjusted gross income figures were not reported for these tax years by the IRS
))
%let year1=2010; %let year2=2011; %let _years=1011;
%doset(libname=irsmig,memname=moinmig&_years,template=_template_inmo,
Usagenotes=%nrbquote(+- The variables TotalHHIncome and AvgHHIncome are now called aggr_AGI and AvgAGI. Median and PerCapi
ta income vars have been dropped.
))
%doset(libname=irsmig,memname=mooutmig&_years,template=_template_outmo,
Usagenotes=%nrbquote(+- The variables TotalHHIncome and AvgHHIncome are now called aggr_AGI and AvgAGI. Median and PerCapi
ta income vars have been dropped.
))
%doset(libname=irsmig,memname=usinmig&_years,template=_template_inus,
Usagenotes=%nrbquote(+- The variables TotalHHIncome and AvgHHIncome are now called aggr_AGI and AvgAGI. Median and PerCapi
ta income vars have been dropped.
))
%doset(libname=irsmig,memname=usoutmig&_years,template=_template_outus,
Usagenotes=%nrbquote(+- The variables TotalHHIncome and AvgHHIncome are now called aggr_AGI and AvgAGI. Median and PerCapi
ta income vars have been dropped.
))
%let year1=2011; %let year2=2012; %let _years=1112;
%doset(libname=irsmig,memname=moinmig&_years,template=_template_inmo,CreatePgm=cnvt_irsmig2,
Usagenotes=%nrbquote(+- Significant changes in the way these returns were processed went into effect with the 11-12 data
.
))
%doset(libname=irsmig,memname=mooutmig&_years,template=_template_outmo,CreatePgm=cnvt_irsmig2,
Usagenotes=%nrbquote(+- Significant changes in the way these returns were processed went into effect with the 11-12 data
.
))
%doset(libname=irsmig,memname=usinmig&_years,template=_template_inus,CreatePgm=cnvt_irsmig2,
Usagenotes=%nrbquote(+- Significant changes in the way these returns were processed went into effect with the 11-12 data
.
))
%doset(libname=irsmig,memname=usoutmig&_years,template=_template_outus,CreatePgm=cnvt_irsmig2,
Usagenotes=%nrbquote(+- Significant changes in the way these returns were processed went into effect with the 11-12 data
.
))
%let year1=2012; %let year2=2013; %let _years=1213;
%doset(libname=irsmig,memname=moinmig&_years,template=_template_inmo,CreatePgm=cnvt_irsmig2,
Usagenotes=%nrbquote(+- Significant changes in the way these returns were processed went into effect with the 11-12 data
.
))
%doset(libname=irsmig,memname=mooutmig&_years,template=_template_outmo,CreatePgm=cnvt_irsmig2,
Usagenotes=%nrbquote(+- Significant changes in the way these returns were processed went into effect with the 11-12 data
.
))
%doset(libname=irsmig,memname=usinmig&_years,template=_template_inus,CreatePgm=cnvt_irsmig2,
Usagenotes=%nrbquote(+- Significant changes in the way these returns were processed went into effect with the 11-12 data
.
))
%doset(libname=irsmig,memname=usoutmig&_years,template=_template_outus,CreatePgm=cnvt_irsmig2,
Usagenotes=%nrbquote(+- Significant changes in the way these returns were processed went into effect with the 11-12 data
.
))
%let year1=2013; %let year2=2014; %let _years=1314;
%let year1=2014; %let year2=2015; %let _years=1415;
%let year1=2015; %let year2=2016; %let _years=1516;
%let year1=2016; %let year2=2017; %let _years=1617;
%let year1=2017; %let year2=2018; %let _years=1718;
%let year1=2018; %let year2=2019; %let _years=1819;
%let year1=2019; %let year2=2020; %let _years=1920;
===========================End commented out================================ */
* Add new years here: ;
%let year1=2021; %let year2=2022; %let _years=2122;
%doset(libname=irsmig,memname=moinmig&_years,template=_template_inmo,CreatePgm=cnvt_irsmig2)
%doset(libname=irsmig,memname=mooutmig&_years,template=_template_outmo,CreatePgm=cnvt_irsmig2)
%doset(libname=irsmig,memname=usinmig&_years,template=_template_inus,CreatePgm=cnvt_irsmig2)
%doset(libname=irsmig,memname=usoutmig&_years,template=_template_outus,CreatePgm=cnvt_irsmig2)
%doset(libname=irsmig,memname=usstateinmig20xx,
memlabel=Inmigration state level for US based on tax returns filed in 2003-04 thru years &year1 and &year2,
geouniv=United States,
units=states by various levels,
Years=%str(0405 thru &_years),
CreatePgm=cnvt_irsmig_states,
Keywords=population migration inmigration irs state adjusted gross income tax returns exemptions,
Description=%nrbquote(Special tabulation from the IRS summarizing tax returns in US filed in ~year1 that were matched to
a return filed in ~year2.. This permits generating a summary based on the FROM geography of the later year. E.g. we can say how
many returns in Missouri in ~year2 were matched to returns in Illinois in ~year1.. The variable FromSumLev indicates the
level of geography for the previous year, while ToSumLev indicates the level for the later year.
ToSumLev is almost always 040, meaning state level, while FromSumLev has many different values.
The data on total exemptions reported on these returns and total adjusted gross income serve as
proxies for total population and various income measures.),
keyvars= Years FromState FromCounty FromSumLev ToState ToCounty ToSumLev ,
keyfmats= | state county sumlev state irscoun irssuml,
DataSource=%str(Internal Revenue Service),
SortedBy=years ToState,
UsageNotes=%nrbquote(- The companion dataset, usoutmig20xx, has data summarizing returns that
reflect outmigration from the state in the specified years.
- Geographic ID variables all begin with "To" or "From" to indicate which side of the flow they describe.
- All income figures are based on the IRS adjusted gross income (AGI) figures and are not compatiable with other standard income
measures such as used by the Census Bureau or BEA. "Per capita" income is the average AGI per exemption.
All income figures areas reported in that tax year and have not been adjusted for inflation.
- Where the total number of "flows" (in or out, depending on the data set) between states is less than 10 no detail is
reported at that level but it will be included in higher level "Other..." summaries such as "Other same state" or "Other Midwest".
- Data for new years is appended to this data set when they become available.
),
Means=MedianIncome AvgHHIncome PerCapitaIncome,
Mweights=NReturns NReturns NExemptions,
URLmeta=%str(https://www.irs.gov/statistics/soi-tax-stats-migration-data),
SubType=in,
SetGroup=us,
debug=1)
%doset(libname=irsmig,memname=usstateoutmig20xx,
memlabel=Outmigration state level for US based on tax returns filed in 2003-04 thru years &year1 and &year2,
geouniv=United States,
units=states by various levels,
Years=%str(0405 thru &_years),
CreatePgm=cnvt_irsmig_states,
Keywords=population migration outmigration irs state adjusted gross income tax returns exemptions,
Description=%nrbquote(Special tabulation from the IRS summarizing tax returns in US filed in ~year1 that were matched to
a return filed in ~year2.. This permits generating a summary based on the To geography of the later year. E.g. we can say how
many returns in Missouri in ~year1 were matched to returns in Illinois in ~year2.. The variable
ToSumLev indicates the level of geography for the current year, while FromSumLev indicates the level
for the previous year. FromSumLev is almost always 040, meaning state level, while ToSumLev has many
different values. The data on total exemptions reported on these returns and total adjusted gross
income serve as proxies for total population and various income measures.),
keyvars= years FromState FromCounty FromSumLev ToState ToCounty ToSumLev,
keyfmats= | state county sumlev state irscoun irssuml,
DataSource=%str(Internal Revenue Service),
SortedBy=years FromState,
UsageNotes=%nrbquote(- The companion dataset, usinmig20xx, has data summarizing returns that
reflect inmigration to the state in the specified years.
- Geographic ID variables all begin with "To" or "From" to indicate which side of the flow they describe.
- All income figures are based on the IRS adjusted gross income (AGI) figures and are not compatiable with other standard income
measures such as used by the Census Bureau or BEA. "Per capita" income is the average AGI per exemption.
All income figures areas reported in that tax year and have not been adjusted for inflation.
- Where the total number of "flows" (in or out, depending on the data set) between states is less than 10 no detail is
reported at that level but it will be included in higher level "Other..." summaries such as "Other same state" or "Other Midwest".
- Data for new years is appended to this data set when they become available.
),
Means =MedianIncome AvgHHIncome PerCapitaIncome,
Mweights=NReturns NReturns NExemptions,
URLmeta=%str(http://www.irs.gov/pub/irs-soi/1213inpublicmigdoc.pdf),
SubType=out,
SetGroup=us,
debug=1)
* proc sort data=irsmig.datasets out=bysortprio; * by sortprio; run;
proc datasets library=irsmig nolist;
modify datasets;
index delete dataset memname;
index create dataset=(libname memname) / unique;
index create memname;
quit;
options mprint msglevel=i;
%gendshtm(libname=irsmig,debug=1,runprocc=1);