x cd /pub/data/cbp/Tools; %let pgm=cnvtyy_naics; filename pgm "&pgm..sas"; /*--This conversion setup used to convert NAICS-based data, starting with the 1998 data. We used cnvtyy.sas to convert 1997 and earlier. The data sets change starting with the 1998 data. The input here is a 3-file .zip archive with the 3 txt files containing data for the US totals, states and counties. We typically (used to) get these files off the cd-rom in the ascii_files subdirectory. They were stored inside a directory of .EXE self-extracting files on the cd-rom. They have to be uploaded as-is to the cbp/exefiles subdirectory, which is where the macro expects to find them. Beginning with 2007 (2005 data) we download the files in .zip format from the Bureau web site -- http://www.census.gov/epcd/cbp/download/dwncbp05.html on 6-4-07, for example Fixing some problems with the conversion macro (new naic02_ format code, using a cbpemp format code fot totemp and fixing some labels and lengths, 6-6-07. Also enhancing geographic codes by merging cbsa related codes from georef.cbsacos (which in 07 had codes as of 2005). Will need to rerun all conversions back to 99. jgb, 6-6-07 Jan, 2008: new code used to convert data at msa (cbsa) level for us. For 2003-2005 initially. (Custom run, copy saved in cnvtyy_naics.msaonly.sas.) Junem 2008: Converting ustotals, states and counties (no msas yet).--; ---*/ libname user '/SAS_temp/userb'; libname cbp '/pub/data/cbp'; /*<=========================Comment out===================================== %let yy=99; %let year=1999; %let yy=00; *<====================EDIT!!!! each year!!!!=======; %let year=2000; %let yy=01; %let year=2001; %let yy=02; %let year=2002; %let yy=03; %let year=2003; %let yy=04; %let year=2004; %let yy=05; %let year=2005; ===========================End commented out================================ */ %let yy=06; %let year=2006; options mprint; *<====while debugging only--; title "Conversion Run for &year County Business Patterns Data"; options nocenter ps=58 noovp; *---the conversion macro is in /pub/sas/macros/cbpcnvt.sas and does most of the work---; ******** US Totals data *******; %cbpcnvt(saslib=cbp,files=us,states=_all_,unzip=1,yr=&yy,debug=0); proc contents data=cbp.ustots&yy position; run; ******** States data *******; %cbpcnvt(saslib=cbp,files=states,states=_all_,unzip=1,yr=&yy); proc contents data=cbp.states&yy position; run; ********* Counties data *******; %cbpcnvt(saslib=cbp,files=counties,states=_all_,unzip=1,yr=&yy); proc contents data=cbp.uscos&yy position; run; *-----------------------------SPECIAL RUN: we use proc datasets, modify to change the format code for industry (naics name) var--; /* modify ustots&yy; format industry $naic02_.; modify states&yy; format industry $naic02_.; modify uscos&yy; format industry $naic02_.; */ *************Metro Areas data***********; %**cbpcnvt(files=msa,yr=&yy) run;