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(), 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(), 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(), 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(), 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(), 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(), 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(), 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(), 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(), 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);