x cd /pub/data/acs2008/Tools; %let pgm=process_mcdcprofiles3yr; filename pgm "&pgm..sas"; *---Process the std usmcdprofiles 3yr data set (re)created by Glenn R. to add geocodes and change sort order. jgb, 2-6-14. Running after problems were found with old version where variables such as fulltime_workers and poor had garbage values. Had Glenn redo the processing and provide the input data sets used here (which will be zipped and archived). ---*; %let year=2008; %let yr=%substr(&year,3,2); %let period=3; *--can be 1, 3 or 5---; %let yearm2=%eval(&year-2); 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---; /*<=========================Comment out===================================== proc sort data=acs.usmcdcprofiles&period.yr_&year out=usmcdcprofiles&period.yr; by geoid; run; ===========================End commented out================================ */ data acs.usmcdcprofiles&period.yr(label="US std profiles for &year vintage &period.yr estimates" index=(state)) nomatch(keep=geoid areaname state stab _ingeos _indata) ; merge acs.allgeos&period.yr (in=ingeos drop=pci where=(state ne '72' and stab ne 'PR') ) usmcdcprofiles&period.yr (in=indata rename=(areaname=_areanameck)); by geoid; DateCreated=today(); format DateCreated date.; if not (indata and ingeos) then do; _nbad+1; /* if _nbad le 10 then put / _all_; else abort abend; delete; */ if ingeos then _ingeos="Y"; else _indata="Y"; output nomatch; end; else output acs.usmcdcprofiles&period.yr; if geocomp='00' 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' 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 puma1 bg submcd macc aits ; *--these vars not used in 1 and 3yr data--; *drop _: ; run; options ls=160; proc print data=nomatch; id _ingeos _indata geoid; format areaname name $32.; run; /*<=========================Comment out===================================== proc print data=acs.usmcdcprofiles&period.yr(keep=_character_ totpop obs=100); where geocomp='00'; by state; id geoid; run; ===========================End commented out================================ */