*********************************NOT USEFUL - see sbg90_sbg2k.sas instead**************************** x cd /pub/data/corrlst/Tools; %let pgm=cnvt.bg090_90_bg090_2k; filename pgm "&pgm..sas"; *---Read the 1990 to 2000 census block correlation files created by Jim Harlan at GRC/MsDIS. Using the corrwt utility macro, generate the derived correlation list dataset, corrlst.mobg090_902k, linking 1990 slvl 090 (split-block group) geography to 2000 sumlev 090 geos. NOTE THAT THERE HAS BEEN A CHANGE IN THE DEFINITION OF SUMMARY LEVEL 090 BETWEEN 1990 & 2000. (SLIGHT). This correlation list will be used by the setup in stf903/Tools to allocate the sl090 data to 2000 090 summary levels. jgb, 5-2-2002 .....just started...to be continued.... ---*; filename corrdbf '/pub/data/corrlst/blkcorr.dbf'; libname corrlst '/pub/data/corrlst'; %libname( mable98); libname mable (mable98); %libname(mable2k) libname stf903 '/pub/data/stf903'; libname user '/SAS_temp/user'; title 'Creating corrlst.mobg090_90_mobg090_2k: 1990 to 2000 Split BG Correlation List'; options ls=132 ps=120; data corrlst.mobg090_902k(label='1990 Block - 2000 Blk corr. for MO'); retain state '29'; length County County90 $5 Tract Tract90 $7 BG bg90 $1 Block Block90 $4 Pop90a AFact 5; set blkcorr2; format county $county. Pop90a comma6. AFact 5.3; by blklnk90; County=state||substr(blklnk00,1,3); tract=substr(tract,1,4)||'.'||substr(tract,5,2); bg=blkgrp; county90=state||substr(blklnk90,1,3); if county ne county90 and first.blklnk90 then do; put '***County code changed:' blklnk90= blklnk00=; end; tract90=substr(blklnk90,4,4)||'.'||substr(blklnk90,8,2); tract90=translate(tract90,'0',' '); block90=substr(blklnk90,10,4); bg90=substr(block90,1,1); apop90= xfactor * pop90; blkpop90=pop90; *<====================New this run========================; pop90a=round(apop90); if xfactor < 1 then if blkpop90 > 0 then xfactor=pop90a/blkpop90; else xfactor=0; *--reasssign allocation factor after rounding; if xfactor > 1 then xfactor=1; *---Not sure why these factors over 1 are in there.--; afact=xfactor; *--we sum the rounded block intersection counts for each blocks. At the end we want to make sure our rounded values still total the block pop total-; if first.blklnk90 then _rsum=pop90a; else _rsum+pop90a; if last.blklnk90 and _rsum ne blkpop90 then do; *--see if the sum of the rounded pop90a values match the total for the 90 block. If not, adjust last block piece-; pop90a= pop90a + (blkpop90 - _rsum); if blkpop90 > 0 then xfactor=pop90a/blkpop90; else xfactor=0; end; keep state--afact; run; proc print label data=corrlst.mobg090_902k(obs=50); by county90; title2 'Sample Obs from Output corrlst set'; run cancel; proc sql; create table bgsums as select county90 as county, tract90 as tract, bg90 as bg, sum(pop90a) as totpopcl from corrlst.mobg090_902k(drop=county tract bg) group by county90, tract90, bg90 ; quit; data stf1pops; *--look for tracts where the 90 pop does not match the value we get by summing our corrlst entries; set stf901x.moi(keep=slvl county tract bg totpop); where slvl='150'; run; *---in run of 3-9-01 the set checks was empty -- all bgs checked!----------------------------*; data checks; merge bgsums(in=incorr) stf1pops(in=inmable); by county tract bg; if not incorr then flag='****Not in correlation list*******************'; else if not inmable then flag='******Not in STF1****************'; else if totpopcl ne totpop then flag='*******Pop sums don''t match*******'; if flag ne ' '; run; proc print data=checks; title2 'Block Groups With Possible / Probable Errors: Corr List pops do not match stf1 at BG level'; run;