x cd /pub/data/acs2016/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 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-14-16 ----The original sas dsets from GR were done wihtout eoc=no option so unreadable with sas9.2 (here). We did a conversion from my desktop - See P:\personal\john\cnvt_temptabs.sas to create the parallel newtabs subdir which we will be using this cycle. ---*; %let year=2016; %let period=1; *--can be 1, 3 or 5 (3 not an option starting with 2016 vintage)--; %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; %include '/pub/sascode/autoexec.sas'; *libname user '/SAS_temp/user'; *<=====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&period.yr; libname temptabs "/pub/data/acs&year/base_tables_1yr/newtabs"; ** access=readonly; libname basetbls "/pub/data/acs&year/base_tables_1yr"; %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 out=ustabs&tabset; by state geoid; run; proc sort data=temptabs.ustabs&tabset._moes out=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) 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( 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 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=1); %dotabset(08,sort=1); %dotabset(09_16,sort=1); %dotabset(17_20,sort=1); %dotabset(21_24,sort=1); %dotabset(25_28,sort=1); %include sascode(notify);