x cd /pub/data/acspums/Tools; %let pgm=invoke_dosets; filename pgm "&pgm..sas";
/*--Invoke the %doset macro to create observations in the Datasets dataset for this directory.
J. Blodgett, OSEDA, Nov, 2006
-- */
title "Job to Invoke doset Macro for Sets in acspums, creating acspums.datasets";
libname acspums '/pub/data/acspums';
/*<=========================Comment out=====================================
proc datasets lib=acspums nolist;
modify datasets;
index create dataset=(libname memname) / unique;
quit;
===========================End commented out================================ */
%***let todo=prhrecs05 prprecs05 puma2cbsatype ushrecs04 usprecs04 moprecs04 mohrecs04 puma2cbsatype; *<===============NOTE!!!===;
%let todo=%str();
%*let todo=usprecs13 usprecs13b ushrecs13 ushrecs13b moprecs13 mohrecs13 moprecs133yr mohrecs133yr;
%*let todo=usprecs13 ushrecs13;
%*let todo=ushrecs14 ushrecs14b usprecs14 usprecs14b moprecs14 mohrecs14;
%let templates=_template_precsyy _template_hrecsyy _template_precsyy5yr _template_hrecsyy5yr;
%let todo=ushrecs15 ushrecs15b usprecs15 usprecs15b moprecs15 mohrecs15 &templates; *<===note changing templates==;
*-----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=acspums,debug=1);
*----------------------------------------------------------------------;
/* =======================Begin comment================
===========================End commented out================================ */
%doset(mode=,libname=acspums,
memname=_template_precsyy,
geouniv=~statenm,
units=Persons,
Year=~_year,
CreatePgm=state_views,
Keywords=pums ACS microdata census ~_year persons,
Description=%nrbquote(Person level dataset for ~statenm for ~_year.. This is a 1% sample of persons.),
keyvars=st puma,
keyfmats=state ,
keyquals=,
sortedby=state serialno,
DataSource=%str(U.S. Bureau of the Census),
UsageNotes=%nrbquote(
- Data for the household in which this person lives is contained in the companion dataset,
~stab.hrecs~yr.
- Users without access to and expertise in using statistical software will not find these datasets very useful.
- All variable names and types are as distributed by the Census Bureau. So their cdbk can be used without having to
worry about variable names being changed.
- SAS users can borrow from the vallabs.sas
module containing codebook type info in the form of SAS proc format Value statements. Even non-SAS users should be able
to benefit from using this as a quick and dirty codebook file.
- Remember to always specify the weight variable pwgtp when creating tables from these data.
- The smallest geographic unit that can be identified on these files is the PUMA. For more info see PUMA page at Census Bureau.
- serialno is the common key (unique within state) that allows linking precs and hrecs data.
),
SubType=hrecs,
SetGroup=us3yr~alpha,
VarSet=,
URLMeta=%str(https://mcdc.missouri.edu/pub/data/acspums/PUMSDataDict~yr..pdf),
filters=,
debug=1)
%doset(mode=,libname=acspums,
memname=_template_hrecsyy,
geouniv=~statenm,
units=Housing Units,
Year=~_year,
CreatePgm=state_views,
Keywords=pums ACS microdata census ~_year households housing units,
Description=%nrbquote(Housing Unit level dataset for ~statenm for ~_year.. This is a 1% sample of housing units.),
keyvars=st puma,
keyfmats=state ,
keyquals=,
sortedby=serialno,
DataSource=%str(U.S. Bureau of the Census),
UsageNotes=%nrbquote(- Data for the persons living in this household are contained in the companion dataset,
~stab.precs~yr.
- All variable names and types are as distributed by the Census Bureau. So their cdbk can be used without having to
worry about variable names being changed.
- SAS users can borrow from the vallabs.sas
module containing codebook type info in the form of SAS proc format Value statements. Even non-SAS users should be able
to benefit from using this as a quick and dirty codebook file.
- It is possible to have an obs on (this) hrecs dataset with no matching data on the precs dataset since it
includes data for vacant housing units.
- Remember to always specify the weight variable wgtp when creating tables from these data.
- The smallest geographic unit that can be identified on these files is the PUMA. For more info see PUMA page at Census Bureau.
- serialno is the common key (unique within state) that allows linking precs and hrecs data.
),
SubType=hrecs,
SetGroup=,
VarSet=,
URLMeta=%str(https://mcdc.missouri.edu/pub/data/acspums/PUMSDataDict~yr..pdf),
filters=,
debug=1)
%doset(mode=,libname=acspums,
memname=_template_precsyy5yr,
memlabel=%nrbquote(~stab Persons recs ~_yearm4 to ~_year),
geouniv=~statenm,
units=Persons,
Year=~_yearm4 to ~_year,
CreatePgm=acs~_year.5yr,
Keywords=pums ACS microdata census ~_year 5yr persons,
Description=%nrbquote(Person level dataset for ~statenm for 5 years ~_yearm4 to ~_year. .),
keyvars=st puma,
keyfmats=state ,
keyquals=,
sortedby=serialno,
DataSource=%str(U.S. Bureau of the Census),
UsageNotes=%nrbquote(- Data for the household in which this person lives is contained in the companion dataset,
~stab.hrecs~yr.5yr.
- Users without access to and expertise in using statistical software will not find these datasets very useful.
- All variable names and types are as distributed by the Census Bureau. So their cdbk can be used without having to
worry about variable names being changed.
- SAS users can borrow from the vallabs.sas
module containing codebook type info in the form of SAS proc format Value statements. Even non-SAS users should be able
to benefit from using this as a quick and dirty codebook file.
- Remember to always specify the weight variable pwgtp when creating tables from these data.
- The smallest geographic unit that can be identified on these files is the PUMA. For more info see PUMA page at Census Bureau.
- serialno is the common key (unique within state) that allows linking precs and hrecs data.
),
SubType=precs5yr,
SetGroup=,
VarSet=,
URLMeta=%str(https://mcdc.missouri.edu/pub/data/acspums/PUMSDataDict~yr..pdf),
filters=,
debug=1)
%doset(mode=,libname=acspums,
memname=_template_hrecsyy5yr,
memlabel=%nrbquote(~stab Housing recs ~_yearm4 to ~_year),
geouniv=~statenm,
units=Housing Units,
Year=~_yearm4 to ~_year,
CreatePgm=acs~_year.5yr,
Keywords=pums ACS microdata census ~_year 5yr households housing units,
Description=%nrbquote(Housing Unit level dataset for ~statenm for 5 years ~_yearm4 to ~_year.. ),
keyvars=st puma,
keyfmats=state ,
keyquals=,
sortedby=serialno,
DataSource=%str(U.S. Bureau of the Census),
UsageNotes=%nrbquote(- Data for the persons living in this household are contained in the companion dataset,
~stab.precs~yr.5yr.
- All variable names and types are as distributed by the Census Bureau. So their cdbk can be used without having to
worry about variable names being changed.
- SAS users can borrow from the vallabs.sas
module containing codebook type info in the form of SAS proc format Value statements. Even non-SAS users should be able
to benefit from using this as a quick and dirty codebook file.
- It is possible to have an obs on (this) hrecs dataset with no matching data on the precs dataset since it
includes data for vacant housing units.
- Remember to always specify the weight variable wgtp when creating tables from these data.
- The smallest geographic unit that can be identified on these files is the PUMA. For more info see PUMA page at Census Bureau.
- serialno is the common key (unique within state) that allows linking precs and hrecs data.
),
SubType=hrecs5yr,
SetGroup=,
VarSet=,
URLMeta=%str(https://mcdc.missouri.edu/pub/data/acspums/PUMSDataDict~yr..pdf),
filters=,
debug=1)
/*<=========================Comment out=====================================
*---These 2 templates only work for single states prior to vintage year 2012---*;
%doset(mode=,libname=acspums,
memname=_template_precsyy3yr,
geouniv=~statenm,
units=Persons,
Year=~_yearm2 to ~_year,
CreatePgm=acs~_year.3yr,
Keywords=pums ACS microdata census ~_year 3yr persons,
Description=%nrbquote(Person level dataset for ~statenm for 3 years ~_yearm2 to ~_year. .),
keyvars=st puma,
keyfmats=state ,
keyquals=,
sortedby=serialno,
DataSource=%str(U.S. Bureau of the Census),
UsageNotes=%nrbquote(- Data for the household in which this person lives is contained in the companion dataset,
~stab.hrecs~yr.3yr.
- Users without access to and expertise in using statistical software will not find these datasets very useful.
- All variable names and types are as distributed by the Census Bureau. So their cdbk can be used without having to
worry about variable names being changed.
- SAS users can borrow from the vallabs.sas
module containing codebook type info in the form of SAS proc format Value statements. Even non-SAS users should be able
to benefit from using this as a quick and dirty codebook file.
- Remember to always specify the weight variable pwgtp when creating tables from these data.
- The smallest geographic unit that can be identified on these files is the PUMA. For more info see PUMA page at Census Bureau.
- serialno is the common key (unique within state) that allows linking precs and hrecs data.
),
SubType=precs3yr,
SetGroup=,
VarSet=,
URLMeta=%str(https://mcdc.missouri.edu/pub/data/acspums/PUMSDataDict~yr..pdf),
filters=,
debug=1)
%doset(mode=,libname=acspums,
memname=_template_hrecsyy3yr,
geouniv=~statenm,
units=Housing Units,
Year=~_yearm2 to ~_year,
CreatePgm=acs~_year.3yr,
Keywords=pums ACS microdata census ~_year 3yr households housing units,
Description=%nrbquote(Housing Unit level dataset for ~statenm for 3 years ~_yearm2 to ~_year.. ),
keyvars=st puma,
keyfmats=state ,
keyquals=,
sortedby=serialno,
DataSource=%str(U.S. Bureau of the Census),
UsageNotes=%nrbquote(- Data for the persons living in this household are contained in the companion dataset,
~stab.precs~yr.3yr.
- All variable names and types are as distributed by the Census Bureau. So their cdbk can be used without having to
worry about variable names being changed.
- SAS users can borrow from the vallabs.sas
module containing codebook type info in the form of SAS proc format Value statements. Even non-SAS users should be able
to benefit from using this as a quick and dirty codebook file.
- It is possible to have an obs on (this) hrecs dataset with no matching data on the precs dataset since it
includes data for vacant housing units.
- Remember to always specify the weight variable wgtp when creating tables from these data.
- The smallest geographic unit that can be identified on these files is the PUMA. For more info see PUMA page at Census Bureau.
- serialno is the common key (unique within state) that allows linking precs and hrecs data.
),
SubType=hrecs3yr,
SetGroup=,
VarSet=,
URLMeta=%str(https://mcdc.missouri.edu/pub/data/acspums/PUMSDataDict~yr..pdf),
filters=,
debug=1)
*----------------Define 2 new templates that work with us 3yr sets 2012+ for us with state intervals and multiple puma codes------;
%macro newtemplates(a);
%doset(mode=,libname=acspums,
memname=_template_usprecsyy3yr&a,
geouniv=~states,
units=Persons,
Year=~_yearm2 to ~_year,
CreatePgm=acs20xx,
Keywords=pums ACS microdata census ~_year 3yr persons,
Description=%nrbquote(Person level dataset for ~states for 3 years ~_yearm2 to ~_year. .),
keyvars=state puma puma00 puma10 Year,
keyfmats=state puma | $puma,
keyquals= | state | state,
sortedby=State serialno,
DataSource=%str(U.S. Bureau of the Census),
UsageNotes=%nrbquote(- Data for the household in which this person lives is contained in the companion dataset,
~stab.hrecs~yr.3yr~alpha..
- Users without access to and expertise in using statistical software will not find these datasets very useful.
- All variable names and types are as distributed by the Census Bureau. So their cdbk can be used without having to
worry about variable names being changed.
- The only variables added by MCDC are State (=ST), Year (first 4 digits of serialno), and puma (long story).
- SAS users can borrow from the vallabs.sas
module containing codebook type info in the form of SAS proc format Value statements. Even non-SAS users should be able
to benefit from using this as a quick and dirty codebook file.
- Remember to always specify the weight variable pwgtp when creating tables from these data.
- The smallest geographic unit that can be identified on these files is the PUMA. For more info see PUMA page at Census Bureau.
- serialno is the common key (unique within state) that allows linking precs and hrecs data.
),
SubType=precs3yr,
SetGroup=us3yr~alpha,
VarSet=,
URLMeta=%str(https://mcdc.missouri.edu/pub/data/acspums/PUMS_DataDict~yearm2.-~year..pdf),
debug=1)
%doset(mode=,libname=acspums,
memname=_template_ushrecsyy3yr&a,
geouniv=~states,
units=Housing Units,
Year=~_yearm2 to ~_year,
CreatePgm=acs20xx,
Keywords=pums ACS microdata census ~_year 3yr households housing units,
Description=%nrbquote(Housing Unit level dataset for ~statenm for 3 years ~_yearm2 to ~_year.. ),
keyvars=state puma puma00 puma10 Year,
keyfmats=state puma | $puma,
keyquals= | state | state,
sortedby=State serialno,
DataSource=%str(U.S. Bureau of the Census),
UsageNotes=%nrbquote(- Data for the household for these persons are contained in the companion dataset,
~stab.hrecs~yr.3yr.
- All variable names and types are as distributed by the Census Bureau. So their cdbk can be used without having to
worry about variable names being changed.
- The only variables added by MCDC are State (=ST), Year (first 4 digits of serialno), and puma (long story).
- SAS users can borrow from the vallabs.sas
module containing codebook type info in the form of SAS proc format Value statements. Even non-SAS users should be able
to benefit from using this as a quick and dirty codebook file.
- It is possible to have an obs on (this) hrecs dataset with no matching data on the precs dataset since it
includes data for vacant housing units.
- Remember to always specify the weight variable wgtp when creating tables from these data.
- The smallest geographic unit that can be identified on these files is the PUMA. For more info see PUMA page at Census Bureau.
- serialno is the common key (unique within state) that allows linking precs and hrecs data.
),
SubType=hrecs3yr,
SetGroup=us3yr~alpha,
VarSet=,
URLMeta=%str(https://mcdc.missouri.edu/pub/data/acspums/PUMS_DataDict~yearm2.-~year..pdf),
filters=,
debug=1)
%mend newtemplates;
%newtemplates(a)
%newtemplates(b)
%newtemplates(c)
%newtemplates(d)
===========================End commented out================================ */
/* <=========================Comment out=====================================
%*let _year=2005; *<--have to use the underscore because year is a doset macro parameter name---;
%let _year=2006;
%let yr=%substr(&_year,3,2);
%let statenm=United States; %let stab=us;
%doset(libname=acspums,memname=ushrecs&yr,template=_template_hrecsyy,
universe=United States,
sortprio=3,sortedby=st serialno)
%doset(libname=acspums,memname=usprecs&yr,template=_template_precsyy,
universe=United States,keyvars=st,
sortprio=3,sortedby=st serialno)
%macro doit1(state,stab);
%doset(libname=acspums,
memname=&stab.precs&yr,template=_template_precsyy)
%doset(libname=acspums,
memname=&stab.hrecs&yr,template=_template_hrecsyy)
%mend doit1;
%**dostates(n=51,names=1,msgs=1,mac=doit1);
;
*---Here we do Puerto Rico--;
%**dostates(72,names=1,mac=doit1);
%let _year=2007; *---for these years (starting with 2007) things have changed a bit. The us datasets are split in 2 and we are not doing the
state views these years.--;
%let _year=2008;
%let _year=2009;
%let _year=2010;
===========================End commented out================================ */
%let _year=2015;
%let yr=%substr(&_year,3,2); %let _yearm2=%eval(&_year-2);
options mprint; *<====;
%let statenm=United States; %let stab=us;
%doset(libname=acspums,memname=ushrecs&yr,template=_template_hrecsyy,
universe=Alabama thru Mississippi,
urlmeta=%str(http://www.census.gov/acs/www/data_documentation/pums_documentation/),
CreatePgm=acs20xx,keyfmats=state, years=%str(&_year),
sortprio=2,sortedby=st serialno,fixindex=0) *<======NOTE fixindex spec here!=========;
%doset(libname=acspums,memname=usprecs&yr,template=_template_precsyy,
universe=Alabama thru Mississippi,keyvars=st,
urlmeta=%str(http://factfinder.census.gov/home/en/acs_pums_&_year._1yr.html),
CreatePgm=acs20xxr,keyfmats=state, years=%str(&_year),
sortprio=2,sortedby=st serialno)
%doset(libname=acspums,memname=ushrecs&yr.b,template=_template_hrecsyy,
universe=Missouri thru Wyoming,
urlmeta=%str(http://www.census.gov/acs/www/data_documentation/pums_documentation/),
CreatePgm=acs20xx,keyfmats=state,
sortprio=1,sortedby=st serialno)
%doset(libname=acspums,memname=usprecs&yr.b,template=_template_precsyy,
universe=Missouri thru Wyoming,keyvars=st,
urlmeta=%str(http://www.census.gov/acs/www/data_documentation/pums_documentation/),
CreatePgm=acs20xx,keyfmats=state,
sortprio=1,sortedby=st serialno)
%let state=29; %let stab=mo; %let statenm=Missouri;
%doset(libname=acspums,
urlmeta=%str(http://www.census.gov/acs/www/data_documentation/pums_documentation/),
CreatePgm=acs20xx,memname=moprecs&yr,template=_template_precsyy)
%doset(libname=acspums,
urlmeta=%str(http://www.census.gov/acs/www/data_documentation/pums_documentation/),
CreatePgm=acs20xx,memname=mohrecs&yr,template=_template_hrecsyy)
%let _year=2013; %let yr=%substr(&_year,3,2);
%let _yearm2=%eval(&_year - 2); *<----for the 3yr pums data sets------;
%doset(libname=acspums,template=_template_hrecsyy3yr,memname=mohrecs&yr.3yr,universe=Missouri,
years=%str(&_yearm2.-&_year),createPgm=acs20xx)
%doset(libname=acspums,template=_template_precsyy3yr,memname=moprecs&yr.3yr,universe=Missouri,
years=%str(&_yearm2.-&_year),createPgm=acs20xx)
/* =======================Begin comment================
%let alpha=a; %let states=Alabama to Hawaii;
%doset(libname=acspums,memname=_template_ushrecsyy3yr&alpha)
%doset(libname=acspums,template=_template_ushrecsyy3yr&alpha,memname=ushrecs&yr.3yr&alpha)
%doset(libname=acspums,template=_template_usprecsyy3yr&alpha,memname=usprecs&yr.3yr&alpha)
%let alpha=b; %let states=Idaho to Mississippi;
%doset(libname=acspums,template=_template_ushrecsyy3yr&alpha,memname=ushrecs&yr.3yr&alpha)
%doset(libname=acspums,template=_template_usprecsyy3yr&alpha,memname=usprecs&yr.3yr&alpha)
%let alpha=c; %let states=Missouri to Oregon;
%doset(libname=acspums,template=_template_ushrecsyy3yr&alpha,memname=ushrecs&yr.3yr&alpha)
%doset(libname=acspums,template=_template_usprecsyy3yr&alpha,memname=usprecs&yr.3yr&alpha)
%let alpha=d; %let states=Pennsylvania to Wyoming;
%doset(libname=acspums,template=_template_ushrecsyy3yr&alpha,memname=ushrecs&yr.3yr&alpha)
%doset(libname=acspums,template=_template_usprecsyy3yr&alpha,memname=usprecs&yr.3yr&alpha)
%let _yearm4=%eval(&_year - 4); *<----for the 5yr pums data sets------;
%let stab=mo; %let statenm=Missouri;
%doset(libname=acspums,template=_template_hrecsyy5yr,memname=mohrecs&yr.5yr,universe=Missouri)
%let stab=il; %let statenm=Illinois;
%doset(libname=acspums,template=_template_precsyy5yr,memname=moprecs&yr.5yr,universe=Missouri)
%doset(libname=acspums,template=_template_hrecsyy5yr,memname=ilhrecs&yr.5yr,universe=Illinois)
%doset(libname=acspums,template=_template_precsyy5yr,memname=ilprecs&yr.5yr,universe=Illinois)
*---The geographic equivalency file relating pumas to cbsa types---;
%doset(libname=acspums,memname=puma2cbsatype,universe=United States,units=puma,year=2000,
memlabel=%nrbquote(Geo Equivalency relating PUMAs to CBSA types: Metropolitan, Micropolitan and Other),
CreatePgm=workforce_tables,
Keywords=puma cbsa metropolitan micropolitan statistical area,
keyvars=state,
keyfmats=state ,
keyquals=,
sortedby=state puma,
DataSource=%str(MABLE geographic database),
Description=%nrbquote(Geographic Equivalency file relating all U.S. PUMAs to CBSA categories: Metropolitan,
Micropolitan and Other),
UsageNotes=%nrbquote(- Use this dataset to link PUMA codes to Metro, Micro and Other areas. This can help you
to create summary data for areas such as the portion of your state that is within a metropolitan area.
- SAS users can study the workfromce_tables.sas program (link just below under program that created this dataset) to
see an example of how this dataset was used to generate summary tables by these 3 geographic components.
- The original data was generated from the MABLE database in November, 2006. The CBSA codes at that time were vintage
December, 2004. The weight variable used to allocate PUMAs that cross CBSA types was the 2000 census population.
- The three Pct variables are actually stored as decimal portions (a value of .01 means 1 percent, not .01 percent) but
display as integers using a SAS format code.
- The MABLE database is accessible by the Geocorr web application.
),
SubType=georef,
SetGroup=,
VarSet=,
URLMeta=,
filters=,
debug=0)
*--------------------------Go back now and generate the 2004 entries for us and mo datasets----------------*;
%let _year=2004; *<--have to use the underscore because year is a doset macro parameter name---;
%let yr=%substr(&_year,3,2);
%let statenm=United States; %let stab=us;
%doset(libname=acspums,memname=ushrecs&yr,template=_template_hrecsyy,
createpgm=_none_,createlib=_none_,sortprio=4,keyvars=st,
universe=United States,
sortedby=st serialno)
%doset(libname=acspums,memname=usprecs&yr,template=_template_precsyy,
universe=United States,keyvars=st,
sortprio=4,sortedby=st serialno)
%let statenm=Missouri; %let state=29; %let stab=mo;
%doset(libname=acspums,
createpgm=_none_,sortprio=4,
memname=moprecs&yr,template=_template_precsyy)
%doset(libname=acspums,createpgm=_none_,sortprio=4,
memname=mohrecs&yr,template=_template_hrecsyy)
*--------------------------end 2004 data------------------------------------------------------------------*;
======================End comment================== */
proc datasets library=acspums nolist;
modify datasets;
index delete dataset memname;
index create dataset=(libname memname) / unique;
index create memname;
quit;
data acspums.datasets; set acspums.datasets; *<------------1-shot update to get rid of setgroup values--;
if setgroup=:'200' then setgroup=' ';
run cancel;
options mprint;
%gendshtm(libname=acspums,debug=1,runprocc=1, sortby=descending latestYear geouniv memname,groupby=latestyear);