x cd /pub/data/acs2012/Tools; %let pgm=process_mcdcprofiles5yr; filename pgm "&pgm..sas"; *---Process the std usmcdprofiles 5yr data set created by Glenn R. to add geocodes and change sort order. jgb, starting 1-6-14 Running after cnvt_geo_files5.sas which created the acs.allgeos2008_2012 data set. ---*; %let year=2012; %let yr=%substr(&year,3,2); %let period=5; *--can be 1, 3 or 5---; %let yearm4=%eval(&year-4); title "&pgm.: Convert Vintage &year &period.yr usmcdcprofiles Data"; options compress=binary; libname user '/SAS_temp/userb'; libname acs&year "/pub/data/acs&year"; *<====; libname acs (acs&year); *--assign alias---; proc sort data=acs.usmcdcprofiles_&yearm4._&year out=usmcdcprofiles&period.yr (drop=years state ); by geoid; run ; *<===================ALREADY RAN===============================================; proc sort data=acs.allgeos&yearm4._&year out= allgeos; by geoid; run; data acs.usmcdcprofiles&period.yr(label="US std profiles for &year vintage &period.yr estimates" index=(sumlev)); retain Years "&yearm4.-&year"; merge allgeos (in=ingeos rename=(pci=pcind)) usmcdcprofiles&period.yr (in=indata rename=(areaname=_areanameck)); **by state geoid; by geoid; ***New for 2012! ***; DateCreated=today(); format DateCreated date.; if not (indata and ingeos) then do; if ingeos and state='72' then delete; if indata and index(_areanameck,'PR') 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 ; 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. (Some did). --; *** drop sldu sldl zcta5 bg submcd macc aits ; *--these vars not used in 1 and 3yr data--; drop _: set ; *--"set" variable is a bug that we need to fix--; run; options ls=160; proc print data=acs.usmcdcprofiles&period.yr(keep=_character_ totpop obs=100); where geocomp='00'; by state; id geoid; run; proc datasets library=acs nolist; index create state; quit;