x cd /pub/data/acs2013/Tools; %let pgm=process_basetabs3yr; filename pgm "&pgm..sas"; *---Process the base tables data sets created by Glenn R. stored in the temptabs subdirectory (we moved them there). 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-22-14 ---*; %let year=2013; %let period=3; *--can be 1, 3 or 5---; %let pyr=3yr; %let yearm4=%eval(&year-4); %let yearm2=%eval(&year-2); %let yr=%substr(&year,3,2); %let cbsayr=13; title "&pgm.: Convert &year &pyr Base Tables Data"; options compress=yes; *<---but we override this (to binary) for the output big table sets---; libname user '/SAS_temp/userb'; *<=====NOTE. may not need this. Space could be a problem with 3yr or 5yr sets--; libname acs&year "/pub/data/acs&year"; *<====; %let geosetname=allgeos&pyr; libname temptabs "/pub/data/acs&year/basetbls/temptabs&pyr"; ** 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); %*--Note that on the input sets GR has an underscore preceding 3yr, whereas in the final sets there is no underscore there.--; %if &sort %then %do; proc sort data=temptabs.ustabs&tabset._&pyr out=ustabs&tabset&pyr; by state geoid; run; proc sort data=temptabs.ustabs&tabset._&pyr._moes out=ustabs&tabset&pyr._moes; by state geoid; run; %end; %if &moes_only %then %goto moes; *---compress=binary added for 3yr data 2013---; data basetbls.ustabs&tabset&pyr(sortedby=state geoid label="US base tabs for topics &tabset - &period.yr data vintage &year" compress=binary); merge acs&year..&geosetname(in=ingeos) ustabs&tabset&pyr (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.&pyr._moes( compress=no sortedby=state geoid 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 ustabs&tabset.&pyr._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; /*<=========================Comment out===================================== %dotabset(00_07,sort=1); %dotabset(08,sort=1); %dotabset(09_16,sort=1); %dotabset(17_20,sort=1); %dotabset(21_24,sort=1); ===========================End commented out================================ */ %dotabset(25_27,sort=1); %*<---name change this cycle. was 25_28 for 1yr data but no topic 28 for 3yr-;