x cd /pub/data/cbp/Tools; %let pgm=invoke_dosets2; filename pgm "&pgm..sas"; *---generate metadata = cbp.datasets for the county business patterns data collection. Running with all datasets converted using the cnvtcbp0709 setup which converted those 3 years of data: 2007, 2008 and 2009. See invoke_dosets.sas for earlier runs including defn of templates. jgb Nov. 2011. Run after each annual cycle starting with 2012 data year. See doyr macro and invocation near bottom. Running 4-15 after converting the 2013 CBP cycle (sans ZBP data - *<=== note commenting out of invocations for 2 zbp sets ) Running 5-16 after converting county and zip level data for 2014 vintage. Running 4-17 after converting county and zip level data for 2015 vintage. ------*; %let todolist=; libname cbp '/pub/data/cbp'; /* ========================begin comment==================================== %doset(mode=,libname=cbp, memname=_template_ustots2, memlabel=%str(National summaries for ~gyear), geouniv=UnitedStates, units=Nation, Year=~gyear, CreatePgm=cnvtcbp0709, Keywords=county business patterns employment industry naics wages national totals, Description=%nrbquote(Summary of business establishments for the nation, by size, by NAICS code for ~gyear.), keyvars=nlevel naics, keyfmats= | naics2_, keyquals=, DataSource=%str(United States Census Bureau), UsageNotes=%nrbquote(), SortedBy=naics, SetGroup=ustots2, VarSet=, SortPrio=1, URLMeta=%str(http://www.census.gov/econ/cbp/index.html), filters=, debug=1) %doset(mode=,libname=cbp, memname=_template_states2, memlabel=%str(State level summaries for ~gyear), geouniv=UnitedStates, units=States, Year=~gyear, CreatePgm=cnvtcbp0709, Keywords=state county business patterns employment industry naics wages, Description=%nrbquote(Summary of business establishments by state, by size, by NAICS code for ~gyear.), keyvars=state nlevel naics, keyfmats=state | naics02_, keyquals=, DataSource=%str(United States Census Bureau), SortedBy=state naics, UsageNotes=%nrbquote(), SetGroup=states2, VarSet=, SortPrio=1, URLMeta=%str(http://www.census.gov/econ/cbp/index.html), debug=0) %doset(mode=,libname=cbp, memname=_template_uscos2, memlabel=%str(County level summaries for ~gyear), geouniv=UnitedStates, units=Counties, Year=~gyear, CreatePgm=cnvtcbp0709, Keywords=county business patterns employment industry naics wages, Description=%nrbquote(Summary of business establishments by county for the entire U.S., by size, by NAICS code (multiple levels) for ~gyear.), keyvars=state county naics nlevel cbsa , keyfmats=state county naics2_ | cbsa | , keyquals=, DataSource=%str(United States Census Bureau), SortedBy=state county naics, UsageNotes=%nrbquote(), SetGroup=counties, VarSet=, SortPrio=1, URLMeta=%str(http://www.census.gov/econ/cbp/index.html), filters=, debug=1) %doset(mode=,libname=cbp, memname=_template_uscbsas2, memlabel=%str(Metro Area (CBSA) level summaries for ~gyear), geouniv=UnitedStates, units=cbsas, Year=~gyear, CreatePgm=cnvtcbp0709, Keywords=county business patterns employment industry naics wages metro areas cbsa, Description=%nrbquote(Summary of business establishments by CBSA (metro/micropolitan stat area) for the entire U.S., by size, by NAICS code (multiple levels) for ~gyear.), keyvars=state nlevel cbsa moflag, keyfmats=state | cbsa | , keyquals=, DataSource=%str(United States Census Bureau), SortedBy=state cbsa naics, UsageNotes=%nrbquote(), SetGroup=cbsas2, VarSet=, SortPrio=1, URLMeta=%str(http://www.census.gov/econ/cbp/index.html), filters=, debug=1) %doset(mode=,libname=cbp, memname=_template_usziptots, memlabel=%str(ZIP Code Totals data for ~gyear), geouniv=UnitedStates, units=zipcodes, Year=~gyear, CreatePgm=cnvtcbp0709, Keywords=zip business patterns employment wages, Description=%nrbquote(Total establishments, employment and payroll data for all US ZIP Codes ~gyear), keyvars=state, keyfmats=state, keyquals=, DataSource=%str(United States Census Bureau), SortedBy=zip, UsageNotes=%nrbquote(), SetGroup=ziptots, VarSet=, SortPrio=1, URLMeta=%str(http://www.census.gov/econ/cbp/index.html), filters=, debug=1) %doset(mode=,libname=cbp, memname=_template_uszipdetails, memlabel=%str(ZIP Code Details data for ~gyear), geouniv=UnitedStates, units=zipcodes/industry, Year=~gyear, CreatePgm=cnvtcbp0709, Keywords=zip business patterns industry naics wages, Description=%nrbquote(Total establishment counts by industry and by employment-size categories for all US ZIP Codes ~gyear), keyvars=state nlevel, keyfmats=state |, keyquals=, DataSource=%str(United States Census Bureau), SortedBy=zip naics, UsageNotes=%nrbquote(), SetGroup=zipdetails, VarSet=, SortPrio=1, URLMeta=%str(http://www.census.gov/econ/cbp/index.html), filters=, debug=1) ==========================end comment====================================== */ *---------------OK, the templates are defined. Now just use them to create entries for each of the years--; %macro doyr(y); %*---NOTE that we must use a parm name other than "year" since that name is already a doset macro parameter name---; %global gyear; %let gyear=&y; %local yr; %let yr=%substr(&gyear,3,2); %doset(libname=cbp,memname=ustots&yr,template=_template_ustots2,createpgm=&_createpgm) %doset(libname=cbp,memname=uscos&yr,template=_template_uscos2,createpgm=&_createpgm) ; %doset(libname=cbp,memname=states&yr,template=_template_states2,createpgm=&_createpgm); %doset(libname=cbp,memname=uscbsas&yr,template=_template_uscbsas2,createpgm=&_createpgm); %doset(libname=cbp,memname=usziptots&yr,template=_template_usziptots,createpgm=&_createpgm); %doset(libname=cbp,memname=uszipdetails&yr,template=_template_uszipdetails,createpgm=&_createpgm); %mend doyr; options mprint; /* ========================begin comment==================================== %let _createpgm=; %doyr(2007) %doyr(2008) %doyr(2009) *-----Converted data for 2 years (2010 and 2011) July, 2013-----; %let _createpgm=cnvtcbp1011; %doyr(2010) %doyr(2011) %doyr(2013) ==========================end comment====================================== */ %let _createpgm=cnvtcbpYY; %*doyr(2014) ; %doyr(2015) ; **proc sort data=cbp.datasets out=bysortprio ; **by sortprio setgroup descending years; ** run; proc datasets library=cbp nolist; modify datasets; index delete dataset memname; index create dataset=(libname memname) / unique; index create memname; quit; options mprint msglevel=i; %gendshtm(libname=cbp,debug=1,runprocc=1,sortby=descending latestYear sortprio setgroup memname,groupby=latestYear);