x cd /pub/data/acs2012/Tools; %let pgm=process_basetabs1yr; filename pgm "&pgm..sas"; *---Process the base tables data sets created by Glenn R. stored in the temptabs subictory. We merge the geos data and modify the format for this platform. See job cnvt_geo_files.sas as precursor to this run. jgb, strting 9-25-13 ---*; %let year=2012; %let period=1; *--can be 1, 3 or 5---; %let yearm4=%eval(&year-4); %let yearm2=%eval(&year-2); %let yr=%substr(&year,3,2); %let cbsayr=13; title "&pgm.: Convert &year &period Geographic headers Data"; options compress=yes; libname acs&year "/pub/data/acs&year"; *<====; %let geosetname=allgeos&period.yr; libname temptabs "/pub/data/acs&year/basetbls/temptabs"; ** access=readonly; libname basetbls "/pub/data/acs&year/basetbls"; %let tabset=00_07; options compress=yes; /* ========================begin comment==================================== *--would not let me do this because the data sets are in windows format.--; proc datasets library=temptabs nolist; *--sort problem with these having to do with PR data with blank State-; modify ustabs&tabset; index create sg=(state geoid); modify ustabs&tabset._moes; index create sg=(state geoid); quit; ==========================end comment====================================== */ %macro dotabset(tabset,sort=1,moes_only=0); %if &sort %then %do; proc sort data=temptabs.ustabs&tabset; by state geoid; run; proc sort data=temptabs.ustabs&tabset._moes; by state geoid; run; %end; %if &moes_only %then %goto moes; data basetbls.ustabs&tabset(sortedby=state geoid label="US base tabs for topics &tabset - &period.yr data vintage &year" ); merge acs&year..&geosetname(in=ingeos) temptabs.ustabs&tabset (in=indata rename=(logrecno=logrecnock)); by state geoid; if logrecno ne logrecnock then do; put /"****Logic of data problem: logrecno values do not match. Run is aborting ****" / geoid= state= logrecno= logrecnock= _n_= ingeos= indata= ; abort abend; end; drop logrecnock; run; %moes: data basetbls.ustabs&tabset._moes( label="US base tabs MOE values only for topics &tabset - &period.yr data vintage &year" ); length State $2 geoid $40 SumLev $3 Geocomp $2 Logrecno 8; set temptabs.ustabs&tabset._moes(rename=(logrecno=logrecnoC)); Sumlev=substr(geoid,1,3); geocomp=substr(geoid,4,2); Logrecno=logrecnoC; drop logrecnoC; *--we convert it to numeric-; run; %mend dotabset; %dotabset(00_07,sort=0,moes_only=1); %dotabset(08,sort=1); %dotabset(09_16,sort=1); %dotabset(17_20,sort=1); %dotabset(21_24,sort=1); %dotabset(25_27,sort=1);