x cd /pub/data/blkrel10/Tools; %let pgm=gen2000_to_2010_equiv; filename pgm "&pgm..sas"; *---Using our 2000 block to 2010 block relationship we add geocodes from blocks to both decades to come up with an equivlaency file across the decade with intersections measured by the 2k population. E.g. we can see how ZCTAs in Mo changed over the decade, creating a 2000-ZCTA to 2010-ZCTA correlation list. jgb, 4/10/12. ---*; libname blkrel10 '/pub/data/blkrel10'; %libname(sf12000x); libname sf12010x '/pub/data/sf12010x' access=readonly; libname user '/SAS_temp/user'; /* ========================begin comment==================================== data clistw2kgeos nomatch; merge blkrel10.mobl2k_bl10(rename=(blk=block) in=inblkrel) sf12000x.moblks(keep=county tract block zcta5 rename=(county=county2k tract=tract2k block=blk2k zcta5=zcta2k) in=insf1); by county2k tract2k blk2k; if not (inblkrel and insf1) then output nomatch; else output clistw2kgeos; run; *---Sort and merge with the 2010 block data just to get the 2010 geos----; proc sort data=clistw2kgeos; by county tract block; run; proc sort data=sf12010x.moblocks(keep=county tract block zcta5 rename=(zcta5=zcta2010)) out=moblocks; by county tract block; run; data clistw2kand10geos nomatch2; merge clistw2kgeos(in=in2k) moblocks(in=in10); by county tract block; if in2k and in10 then output clistw2kand10geos; else output nomatch2; run; ==========================end comment====================================== */ proc sort data=clistw2kand10geos(keep=zcta2k zcta2010 pop2kint) out=corrwtin; by zcta2k zcta2010; run; %corrwt(setin=corrwtin,setout=blkrel10.mozcta00_zcta2010, g1=zcta2k,g2=zcta2010, wtvar=pop2kint, keepwt=1); proc print data=blkrel10.mozcta00_2010 (obs=250); title "First 250 Obs of blkrel10.mozcta00_zcta2010"; by zcta2k; id zcta2k; run;