x cd /pub/data/acs2011/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, Sep. 2012 Jan. /Feb. 2013 March 9, 2013: Rerunning with deleted data sets deleted and with special step to reassing sortprio to get more logical ordering of Datasets. Rerun 10-31-13 after we replace the "2" suffix sets with alt suffix, i.e. usmcdcprofiles5yralt. -- */ title "Job to Invoke doset Macro for Sets in acs2011, creating acs2011.datasets"; %*et todolist=ussldu12s5yr ussldl12s5yr ; %*let todolist=usmcdcprofiles3yr usmcdcprofiles5yr; %let todolist=usmcdcprofiles5yralt; %let libnameG=acs2011; libname acs2011 '/pub/data/acs2011'; /*<=========================Comment out===================================== *-----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=acs2011,debug=1); ===========================End commented out================================ */ *----------------------------------------------------------------------; %doset( memname=usmcdcprofiles ,memlabel=%str(Single year 2011 summaries for all areas with pop of at least 65000), libname =acs2011,urlmeta=%str(/pub/data/acs2011/Variables.pdf), units=us state county place puma cd etc, years=2011, universe=United States, sortprio=1, keyvars=sumlev state county placefp, keyfmats=sumlev state county place, keyquals= | | | state, Description = %nrbquote(Data for all large US geographies, 2011 1-year Period Estimates), UsageNotes=%nrbquote(), debug=0); %doset( memname=usmcdcprofiles3yr,memlabel=%str(2009-2011 3-year summaries for all areas with pop of at least 20000), libname =acs2011,urlmeta=%str(/pub/data/acs2011/Variables3yr.pdf), units=us state county place puma cd etc, years=%str(2009-2011), universe=United States, sortprio=1, keyvars=sumlev state county placefp, keyfmats=sumlev state county place, keyquals= | | | state, Description = %nrbquote(Data for all large and medium US geographies, 2009-2011 3-year Period Estimates), UsageNotes=%nrbquote(), debug=0); %doset( memname=usmcdcprofiles5yr,memlabel=%str(2007-2011 5-year summaries for all areas), libname =acs2011,urlmeta=%str(/pub/data/acs2011/Variables5yr.pdf), units=us state county place puma cd tract etc, years=%str(2007-2011), universe=United States, sortprio=1, keyvars=sumlev state county placefp geocomp, keyfmats=sumlev state county place geocomp, keyquals= | | | state, Description = %nrbquote(Data for all US geographies, regardless of pop size, 5-year Period Estimates), UsageNotes=%nrbquote(), debug=0); %doset( memname=usmcdcprofiles5yr2, Memlabel = %nrbquote(Same as usmcdcprofiles5yr but with all MOE variables moved to the end of the observations), libname=acs2011,urlmeta=%str(/pub/data/acs2011/Variables5yr.pdf), units=us state county place puma cd tract etc, years=%str(2007-2011), universe=United States, sortprio=1, keyvars=sumlev state county placefp geocomp, keyfmats=sumlev state county place geocomp, keyquals= | | | state, Description = %nrbquote(Alternate version of usmcdcprofiles5yr but with all MOE variables moved to the end of the observations), UsageNotes=%nrbquote(), debug=0); %doset( memname=usgeocomps5yr,memlabel=%str(Period Estimates (2007-2011 5-year) for all US Geographic Components), libname=acs2011,urlmeta=%str(/pub/data/acs2011/Variables5yr.pdf), CreatePgm=mcdcprofiles5yr, units=str(us state region division etc/geocomp), years=%str(2007-2011), universe=United States, keyvars=sumlev state geocomp, keyfmats=sumlev state geocomp, keyquals=%str( | | | ) , Description = %nrbquote(Data for all US geographic components, such as urban and rural portions, 5-year Period Estimates), UsageNotes=%nrbquote(), debug=0); %doset( memname=usregdiv5yr, libname=acs2011,urlmeta=%str(/pub/data/acs2011/Variables5yr.pdf), CreatePgm=mcdcprofiles5yr, units=str(us region division), years=%str(2007-2011), universe=United States, keyvars=sumlev , keyfmats=sumlev, Description = %nrbquote(Data for US (nation totals), Regions, and Division), UsageNotes=%nrbquote(), debug=0); %doset( memname=usstcnty5yr, libname=acs2011,urlmeta=%str(/pub/data/acs2011/Variables5yr.pdf), units=State County, years=%str(2007-2011), universe=United States, keyvars=sumlev state county cbsa, keyfmats=sumlev state county cbsa, Description = %nrbquote(Period Estimates (2007-2011 5-year) for all US States Counties and Equivalents), UsageNotes=%nrbquote(), debug=0); %doset( memname=usplaces5yr,memlabel=, libname=acs2011,urlmeta=%str(/pub/data/acs2011/Variables5yr.pdf), CreatePgm=mcdcprofiles5yr, units=%str(place and place/county), years=%str(2007-2011), universe=United States, keyvars=sumlev state county placefp, keyfmats=sumlev state county place, keyquals=%str(| | | state), Description = %nrbquote(Period Estimates (2007-2011 5-year) for all US Cities), UsageNotes=%nrbquote(), debug=0); %doset( memname=uscousubs5yr,memlabel=, libname=acs2011,urlmeta=%str(/pub/data/acs2011/Variables5yr.pdf), CreatePgm=mcdcprofiles5yr, units=%str(mcds (county subdivisions)), years=%str(2007-2011), universe=United States, keyvars=state county lsadc, keyfmats=state county lsadc, Description = %nrbquote(Period Estimates (2007-2011 5-year) for all US County Subdivisions), UsageNotes=%nrbquote(), debug=0); %doset( memname=uscdslds5yr,memlabel=%str(111th CD and 2009 state leg district data), libname=acs2011,urlmeta=%str(/pub/data/acs2011/Variables5yr.pdf), CreatePgm=mcdcprofiles5yr, units=%str(cd sldu sldl), years=%str(2007-2011), universe=United States, keyvars=sumlev state county , keyfmats=sumlev state county, Description = %nrbquote(Period Estimates (2007-2011 5-year) for all US Congressional and State Legislative Districts), UsageNotes=%nrbquote(), debug=0); %doset( memname=usschools5yr,memlabel=, libname=acs2011,urlmeta=%str(/pub/data/acs2011/Variables5yr.pdf), CreatePgm=mcdcprofiles5yr, units=%str(School District), years=%str(2007-2011), universe=United States, keyvars=sumlev state, keyfmats=sumlev state, Description = %nrbquote(Period Estimates (2007-2011 5-year) for all US School Districts), UsageNotes=%nrbquote(), debug=0); %doset( memname=uspumas5yr,memlabel=, libname=acs2011,urlmeta=%str(/pub/data/acs2011/Variables5yr.pdf), CreatePgm=mcdcprofiles5yr, units=%str(2010 PUMAs), years=%str(2007-2011), universe=United States, keyvars=state, keyfmats=state, Description = %nrbquote(Period Estimates (2007-2011 5-year) for all US Public Use Microdata Areas), UsageNotes=%nrbquote(), debug=0); %doset( memname=usurbareas5yr,memlabel=, libname=acs2011,urlmeta=%str(/pub/data/acs2011/Variables5yr.pdf), CreatePgm=mcdcprofiles5yr, units=%str(2002 Urban Areas), years=%str(2007-2011), universe=United States, keyvars=, keyfmats=, Description = %nrbquote(Period Estimates (2007-2011 5-year) for all US Urban Clusters and Urbanized Areas), UsageNotes=%nrbquote(), debug=0); %doset( memname=usmetros5yr,memlabel=, libname=acs2011,urlmeta=%str(/pub/data/acs2011/Variables5yr.pdf), CreatePgm=mcdcprofiles5yr, units=%str(2010 Metro Areas), years=%str(2007-2011), universe=United States, keyvars=sumlev cbsa csa metdiv state, keyfmats=sumlev cbsa csa metrodiv state, Description = %nrbquote(Period Estimates (2007-2011 5-year) for all US CBSAs, CSAs, Metro Divs and New England Metro Areas), UsageNotes=%nrbquote(), debug=0); %doset( memname=uszctas5yr,memlabel=, CreatePgm=mcdcprofiles5yr, units=%str(ZCTAs), years=%str(2007-2011), universe=United States, keyvars=state, keyfmats=state, Description = %nrbquote(Period Estimates (2007-2011 5-year) for all US ZCTAs,), UsageNotes=%nrbquote(), debug=0); run; %doset( memname=usamindianetc5yr,memlabel=, libname=acs2011,urlmeta=%str(/pub/data/acs2011/Variables5yr.pdf), CreatePgm=mcdcprofiles5yr, units=%str(American Indian Resevations etc), years=%str(2007-2011), universe=United States, keyvars=sumlev state, keyfmats=sumlev state, Description = %nrbquote(Period Estimates (2007-2011 5-year) for all US American Indian Reservations and Similar Areas), UsageNotes=%nrbquote(), debug=0); %doset( memname=ustracts5yr,memlabel=, libname=acs2011,urlmeta=%str(/pub/data/acs2011/Variables5yr.pdf), CreatePgm=mcdcprofiles5yr, units=%str(2010 census tract), years=%str(2007-2011), universe=United States, keyvars=sumlev state county cbsa, keyfmats=sumlev state county cbsa, Description = %nrbquote(Period Estimates (2007-2011 5-year) for all US Census Tracts), UsageNotes=%nrbquote(), debug=0); %doset( memname=usbgs5yrtemp,memlabel=, libname=acs2011,urlmeta=%str(/pub/data/acs2011/Variables5yr.pdf), CreatePgm=tempusbgs, units=%str(2010 Block Groups), years=%str(2007-2011), universe=United States, keyvars=state county, keyfmats=state county, Description = %nrbquote(Period Estimates (2007-2011 5-year) for all US block groups), UsageNotes=%nrbquote(), debug=0); %doset( libname=acs2011,urlmeta=%str(/pub/data/acs2011/Variables5yr.pdf), memname=uscd113s5yr,memlabel=%bquote(MCDC estimated 113th CD data allocated from tract estimates), CreatePgm=uscd113slds_allocation, units=%str(113th CDs), years=%str(2007-2011), universe=United States, keyvars=state, keyfmats=state, sortedby=state, Description = %nrbquote(Unofficial allocated estimates of 113th CDs), UsageNotes=%nrbquote(), debug=0); run; %doset( libname=acs2011,urlmeta=%str(/pub/data/acs2011/Variables5yr.pdf), memname=ussldl12s5yr,memlabel=%bquote(MCDC estimated 2012 state leg district allocated from tract estimates),sortprio=3, CreatePgm=uscd113slds_allocation, units=%str(2012 SLDs lower chamber/House), years=%str(2007-2011), universe=United States, keyvars=state, keyfmats=state, sortedby=state, Description = %nrbquote(Unofficial allocated estimates of 2012 state House (lower chamber) districts), UsageNotes=%nrbquote(), debug=0); run; %doset( libname=acs2011,urlmeta=%str(/pub/data/acs2011/Variables5yr.pdf), memname=ussldu12s5yr,memlabel=%bquote(MCDC estimated 2012 state leg district allocated from tract estimates),sortprio=3, CreatePgm=uscd113slds_allocation, units=%str(2012 SLDs upper chamber/Senate), years=%str(2007-2011), universe=United States, keyvars=state, keyfmats=state, sortedby=state, Description = %nrbquote(Unofficial allocated estimates of 2012 state Senate (higher chamber) districts), UsageNotes=%nrbquote(), debug=0); run; *-----------------------Now do the Missouri subset views-----------------------------*; %Macro moview(setname); %doset(memname=mo&setname.5yr,template=us&setname.5yr,universe=Missouri,memlabel=Mo Subset of us&setname.5yr, description=Missouri subset of us&setname.5yr,sortprio=4) ; %mend moview; /* ========================begin comment==================================== %moview(cdslds) %moview(cousubs) %moview(places) %moview(pumas) %moview(schools) %moview(stcnty) %moview(tracts) %moview(zctas) %moview(cd113s) %moview(sldl12s) %moview(sldu12s) *----Custom data step to modify the sortprio values--------*; data acs2011.datasets; set acs2011.datasets_old; if memname=:'usmcdcprofiles' then sortprio=1; else if memname=:'us' and substr(memname,length(memname)-2,3)='5yr' then sortprio=3; else if memname='usbgs5yrtemp' then sortprio=4; else if memname=:'mo' then sortprio=5; else if memname=:'allgeos' then sortprio=6; else if units ne ' ' then sortprio=7; else sortprio=9; run; ==========================end comment====================================== */ %doset( memname=usmcdcprofiles5yralt, Memlabel =%nrbquote(Similar to usmcdcprofiles5yr but no tracts or BGs, with all MOE variables moved to the end of the observations), Createpgm=mcdcprofiles5yralt, libname=acs2011,urlmeta=%str(/pub/data/acs2011/Variables5yr.pdf), units=us state county mcd place puma cd ZCTA etc, years=%str(2007-2011), universe=United States, sortprio=1, keyvars=sumlev state county placefp geocomp cbsa, keyfmats=sumlev state county place geocomp cbsa, keyquals= | | | state, Description = %nrbquote(Alternate version of usmcdcprofiles5yr but with all MOE variables moved to the end of the observations), UsageNotes=%nrbquote(), debug=0); proc sort data=acs2011.datasets out=bysortprio; by sortprio ; *run; proc datasets library=acs2011 nolist; modify datasets; index delete dataset memname; index create dataset=(libname memname) / unique; index create memname; quit; options mprint msglevel=i; %gendshtm(libname=acs2011,debug=1,runprocc=1);