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(
- The LFO variable IDs legal form of orgnztn. Added to ustots for 2008. To ignore and
just get totals code filter
LFO = - (where the value is a single dash).
- Information on total establishments, total employees, annual and 1st quarter payrolls for the
specified NAICS (industry). Data is then repeated for businesses by size class: those employing 1 to 4 persons,
those employing 5 to 9, etc. Total employment and wage data are also reported by size category. But there is significant
suppression of some of these items to avoid disclosure.
- There is a summary for NAICS code '------' which means all industries and is "level 0". In general dashes or slashes
used within a NAICS code indicate the
level of the code. Code 11---- is considered a level 1 code, while code 113/// is considered a level 2 code.
- The variable Industry contains the same value as the variable naics.
But a format code is associated with it so that it displays as the name of the naics industry.
- These data were converted to SAS datasets by reading the ascii files provided on the cd-roms issued by the Census Bureau or
(starting with 2005 data) downloaded from the Bureau web site.
),
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(- The LFO variable IDs legal form of orgnztn. Added at state level for 2010. To ignore and
just get totals code filter
LFO = - (where the value is a single dash).
- Information on total establishments, total employees, annual and 1st quarter payrolls for the
specified state/NAICS (industry). Data is then repeated for businesses by size class: those employing 1 to 4 persons,
those employing 5 to 9, etc. Total employment and wage data are also reported by size category. But there is significant
suppression of some of these items to avoid disclosure.
- There is a summary for NAICS code '------' which means all industries and is "level 0". In general dashes or slashes
used within a NAICS code indicate the
level of the code. Code 11---- is considered a level 1 code, while code 113/// is considered a level 2 code.
- The variable Industry contains the same value as the varible naics.
But a format code is associated with it so that it displays as the name of the naics industry.
- These data were converted to SAS datasets by reading the comma-delimited files downloaded from the Bureau web site -
http://www.census.gov/econ/cbp/download/index.htm
),
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(- Information on total establishments, total employees, annual and 1st quarter payrolls for the
specified county / NAICS (industry). Counts of businesses by size class: those employing 1 to 4 persons, those employing
5 to 9, etc. At this level there is no wage or total employment reported at the employment-size level as there is with the state
and national data sets.
- There is a summary for NAICS code '------' which means all industries and is "level 0". In general dashes or slashes
used within a NAICS code indicate the
level of the code. Code 11---- is considered a level 1 code, while code 113/// is considered a level 2 code.
- The variable Industry contains the same value as the variable naics.
But a format code is associated with it so that it displays as the name of the naics industry.
- These data were converted to SAS datasets by reading the comma-delimited files downloaded from the Bureau web site -
http://www.census.gov/econ/cbp/download/index.htm
),
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(- Information on total establishments, total employees, annual and 1st quarter payrolls for the
specified CBSA / NAICS (industry). Counts of businesses by size class: those employing 1 to 4 persons, those employing
5 to 9, etc. At this level there is no wage or total employment reported at the employment-size level as there is with the state
and national data sets.
- There is a summary for NAICS code '------' which means all industries and is "level 0". In general dashes or slashes
used within a NAICS code indicate the
level of the code. Code 11---- is considered a level 1 code, while code 113/// is considered a level 2 code.
- The variable Industry contains the same value as the variable naics.
But a format code is associated with it so that it displays as the name of the naics industry.
- These data were converted to SAS datasets by reading the comma-delimited files downloaded from the Bureau web site -
http://www.census.gov/econ/cbp/download/index.htm
- We added the variable PopJL09 the post-censal pop estimate for the CBSA as defined as of July, 2009.
- Variable Counties contains the names of the counties comprising the CBSA as of July, 2009.
- These are complete CBSAs, NOT within-state.
),
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(- Information on total establishments, total employees, annual and 1st quarter payrolls for all
ZIP codes in US.
- No NAICS detail on this data set (see corr zipdetails set if you need that).
- State codes were assigned based on the state where the ZIP is primarily located. Some ZIPs cross state lines.
- These data were converted to SAS datasets by reading the comma-delimited files downloaded from the Bureau web site at
http://www.census.gov/econ/cbp/download/index.htm
- These are actual ZIP codes, not ZCTAs (the Bureau substitute for ZIP codes on many data products). They can change their
definition without changing the code over time so be careful.
),
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(- Total establishment counts only - no employment or payroll data.
- State codes were assigned based on the state where the ZIP is primarily located. Some ZIPs cross state lines.
- These data were converted to SAS datasets by reading the comma-delimited files downloaded from the Bureau web site at
http://www.census.gov/econ/cbp/download/index.htm
- These are actual ZIP codes, not ZCTAs (the Bureau substitute for ZIP codes on many data products). They can change their
definition without changing the code over time so be careful.
- This dataset is huge - over 3 million observations.
),
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);