x cd /pub/data/corrlst/Tools; %let pgm=mozip2cdslds2012; filename pgm "&pgm..sas"; *---Combine block level data showing ZCTAs (2010) and state CD and LDs after 2011 redistricting to get 3 equivalency data sets. jgb, 5-30-12. ---*; title "ZIP to Missouri Legislative Districts for 2012. "; libname user '/SAS_temp/user'; libname corrlst '/pub/data/corrlst'; libname pl942010 '/pub/data/pl942010' access=readonly; /* ========================begin comment==================================== proc sql; create table blkpops as select county,tract,block from pl942010.mosums where sumlev='750' order by county, tract, block; quit; data merged badblocks ; merge corrlst.moblk2cdslds2011(in=in1) corrlst.moblkzcta10(in=inzip) blkpops(in=inpl94) end=last; by county tract block; if not inpl94 then _badblock+1; else if not in1 then _noinslds+1; else if not inzip then _nozips+1; else do; output merged ; return; end; output badblocks; drop _: ; if last then put _all_; run; %corrwt (setin=merged, setout=mozctacd113, g1=zcta, g2=cd113,wtvar=totpop,keepwt=1) run; data corrlst.mozctacd113(label="ZIP to 113th CDs for Mo, w 2010 Pops"); set; if zcta ne ' '; label totpop='Total Pop 2010'; run; ==========================end comment====================================== */ %corrwt (setin=merged, setout=mozctaHouse12, g1=zcta, g2=House12,wtvar=totpop,keepwt=1) run; data corrlst.mozctaHouse12(label="ZIP to new (2012) House Districts for Mo, w 2010 Pops"); set; if zcta ne ' '; label totpop='Total Pop 2010'; run; %corrwt (setin=merged, setout=mozctaSenate12, g1=zcta, g2=Senate12,wtvar=totpop,keepwt=1) run; data corrlst.mozctaSenate12(label="ZIP to new (2012) Senate Districts for Mo, w 2010 Pops"); set; if zcta ne ' '; label totpop='Total Pop 2010'; run;