x cd /pub/data/acs2012/Tools; %let pgm=process_basetabs3yr; filename pgm "&pgm..sas"; *---Process the base tables data sets created by Glenn R. stored in the temptabs subictory. We merge the geos data to create the final 3yr basetables. Used command "sudo mv ustabs*3yr*.sas7bdat temptabs" from acs2012/basetbls to put GRs files in the temptabs subdir. See job cnvt_geo_files.sas as precursor to this run. jgb, starting 11-20-13 ---*; %let year=2012; %let period=3; *--can be 1, 3 or 5---; %let yearm4=%eval(&year-4); %let yearm2=%eval(&year-2); %let yr=%substr(&year,3,2); %**let cbsayr=09; *---this gets taken care of in the cnvt_geo_files setup--; 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 (with 1yr data have not tried with 3yr) because the data sets were 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.&period.yr; by state geoid; run; proc sort data=temptabs.ustabs&tabset.&period.yr_moes; by state geoid; run; %end; %if &moes_only %then %goto moes; data basetbls.ustabs&tabset&period.yr(sortedby=state geoid label="US base tabs for topics &tabset - &period.yr data vintage &year" ); merge acs&year..&geosetname(in=ingeos) temptabs.ustabs&tabset&period.yr (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.&period.yr_moes( compress=NO 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.&period.yr_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; options mprint; /*<=========================Comment out===================================== %dotabset(00_07,sort=1,moes_only=0); ===========================End commented out================================ */ options NOmprint; %dotabset(08,sort=1); %dotabset(09_16,sort=1); %dotabset(17_20,sort=1); %dotabset(21_24,sort=1); %dotabset(25_27,sort=1);