x cd /pub/data/acs2008/Tools; %let pgm=create_basetbls_3yr; filename pgm "&pgm..sas"; *---This job is only used to process the 3-year period data for 2008. We coded a separate create_basetbls.sas setup earlier to do similar processing of the 1yr data. We originally just uploaded the 3yr data from the datasets on the P: drive and did no merging of the geographic ids from the allgeos3yr dataset. But now we are going to do that standard processing.---; *---The base tables data sets are mostly created by Billy Earny on the new platform and are copied to the P: drive from which they are uploaded and stored in the temp directory. The allgeos data set also is stored there and is converted to the final copy by the create_allgeos setup in this program library. In this setup we create the final, permanent basetbls datasets by merging and renaming the ustabs datasets in temp with the final allgeos dataset. To summarize the process of creating the acs2008\basetbls 3yr data sets: 1. bce downloads the raw data from CB web site. These get converted to mysql and then to sas datasets. These are then copied to the P: drive (\mcdc\acs2008_3yr\basetbls ). These have the basic data but need work regarding some naming conventions and the addition of standard geographic data. 2. The state level geographic data files are processed by bce to create an allgeos3yr dataset which is also copied to the P: drive, acs2008_3yr\basetbls folder. 3. Setup upload_edit_basetbls3yr.sas is created (in the above basetbls directory on P:) and is run to upload the basetbls datasets to /pub/data/temp on this AIX site. We also upload a copy of that sas program file to this (Tools) directory. IMPORTANT NOTE: This is NOT what happened in Nov 2009 when we coded and ran this setup. The 3yr datasets were uploaded to the acs2008/basetbls directory instead of the temp directory and this setup was NOT then run to add the geo variables. We are just now dealing with this inconsistency in May of 2010. Better late than never. We went to the acs2008/basetbls dir and used cp *3yr* /pub/data/temp to put the uploaded datasets over in the temp directory where they belonged. And now we shall write over the original copies, creating new version that have been upgraded to include the geos. 4. We run the create_allgeos.sas setup here to access the uploaded temp.allgeos dataset and do final enhancements to it, creating acs2008.allgeos dataset. (NO - not really. We just use the dataset as uploaded here.) 5. This job (re)creates the ustabsXXXXX3yr and ustabswxxxxx_moes3yr datasets in /pub/data/acs2008/basetbls by merging the corresponding temp datasets with the acs2008.allgeos3yr dataset. jgb, 5-7-2010 ---*; %let period=3yr; %let subdir=%str(3yr/); %let year=2008; %let yr=%substr(&year,3,2); %let yearm1=%eval(&year-1); %let yearm2=%eval(&year - 2); title "&pgm.: Create Final &year &period Base Tables Datasets"; libname acs&year "/pub/data/acs&year"; *<====; libname temp '/pub/data/temp'; libname basetbls "/pub/data/acs&year/basetbls"; options compress=binary; /* ========================begin comment==================================== proc sort data=acs2008.allgeos3yr force; by geoid; run; ==========================end comment====================================== */ *<==================================Check to see if the temp datasets have the same names for current data*******************; *---we changed the keep list for the allgeos3yr set to stop at sduni instead of LogRecno. This adds vars County CBSA cbsaType UA, PlaceFP, PUMA5, sdelm, sdsec and sduni . So much for consistency----; %macro dotabs(tbls); %local _type; %do _type=1 %to 2; %if &_type=2 %then %let moe=_moes; %else %let moe=; data basetbls.ustabs&tbls&moe&period(index=(geoid)); retain Years "&yearm2 - &year" Period "&period"; merge acs&year..allgeos&period(in=ingeos keep=SumLev--sduni where=(state ne '72')) temp.ustabs&tbls.&moe&period(in=indata keep=geoid _numeric_ rename=(logrecno=_logrecnock)); by geoid; if not (ingeos and indata) or logrecno ne _logrecnock then do; put '****We have a problem with the merge: data is missing or inconsistent*** ' geoid= areaname= ingeos= indata= logrecno= _logrecnock= ; abort abend; end; drop _: ; run; %end; %*---do _type loop---; data _null_; file log; put "**** &tbls datasets successfully processed ****" ; file stdout; put "**** &tbls datasets successfully processed ****" ; run; %mend dotabs; options mprint; %dotabs(00_07) %dotabs(08) %dotabs(09_16) %dotabs(17_20) %dotabs(21_24) %dotabs(25_27)