x cd /home/riceg/ACS_SAS_processing; %let pgm=process_mcdcprofiles5yr; filename pgm "&pgm..sas"; /* Process the std usmcdprofiles 5yr data set to add geocodes and change sort order. New for 2016 vintage: have to drop state and county on input data set because they were numeric. Run after cnvt_geo_files5.sas, which creates the acs.allgeos[yyyy_yyyy] dataset. */ %let year=2017; %let yr=%substr(&year,3,2); %let yearm4=%eval(&year-4); title "&pgm.: Convert &year 5yr Geographic headers Data"; %include '/pub/sas/autoexec.sas'; options compress=binary; libname user '/home/riceg/ACS_SAS_processing/temp'; libname acs&year "/pub/data/acs&year"; libname acs (acs&year); /* proc datasets library=acs; modify usmcdcprofiles5yr; index create geoid; run ; */ proc sort data=acs.allgeos&yearm4._&year out=user.allgeos; by geoid; run; *data user.usmcdcprofiles5yr(label="US std profiles for &year vintage 5yr estimates" index=(sumlev)); *-- TEST ; data acs.usmcdcprofiles5yr(label="US std profiles for &year vintage 5yr estimates" index=(sumlev)); retain Years "&yearm4.-&year"; merge allgeos (in=ingeos rename=(pci=pcind)) acs.usmcdcprofiles5yr (in=indata rename=(areaname=_areanameck) drop=state county); *-- note drop ; by geoid; DateCreated=today(); format DateCreated date.; if not (indata and ingeos) then do; if ingeos and state='72' then delete; if indata and index(_areanameck,'Puerto') then goto aftr; _nbad+1; if _nbad le 10 then put / _all_; else abort abend; delete; end; aftr: if geocomp='00' and ingeos and indata and (not (areaname=: _areanameck)) then do; *-- We have some (outdated) PUMA names for Misssouri that we now have to replace the official names ; if geoid=:'79500US29' | index(_areanameck,'Navajo') then ; *-- We comment out because all it was flagging was hispanic names with special accent characters ; * else put /'**areanames do not match: ' state= geoid= areaname= _areanameck=; end; format pct: 5.1; *-- some of the percentage variables did not have formats associated with them. ; drop _: set ; *-- "set" variable is a bug that we need to fix ; run; /* options ls=160; proc print data=usmcdcprofiles5yr(keep=_character_ totpop obs=100); where geocomp='00'; by sumlev; id state geoid; run; */ proc datasets library=acs nolist; modify usmcdcprofiles5yr; index create state; quit; %include sascode(notify);