x cd /pub/data/corrlst/Tools; %let pgm=sbg90_sbg2k; 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.&pgm , 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. Some confussion about the final official version of this conversion. THIS IS THE GOOD VERSION. Being rerun Aug. 2002 to check for some apparent missing data in the corr list. detected when we tried to allocation the sl090 data to leg. districts. ---*; filename corrdbf '/pub/data/corrlst/blkcorr.dbf'; libname corrlst '/pub/data/corrlst'; *libname( mable98); *libname mable (mable98); %libname(stf901); %libname(mable2k) libname stf903 '/pub/data/stf903'; proc sort data=stf903.mosl090 force; by county cousubfp placefp tract urbarea urbanrur cd bg; run; *<====; libname user '/SAS_temp/user'; title 'Creating corrlst.mosbg90_sbg2k: 1990 to 2000 Split BG Correlation List'; options ls=132 ps=120; *--we need some extra codes based on the 2k census block. We use the mable database because for now that is the only place we can get the required ur (Urban/Rural flag) code--; data xcodes2k ; *--additional 2k geocodes that need to be added to corr. list--; set mable2k.mov(keep=county tract block placefp cousubfp ur bg); ***where county le '29003'; ********************************************; rename ur=UrbanRur; *<--this is the name used in the Bureau data dictionary and stored on our sf geo headers-; run; *--Define an index so that in the merge step, below, we can do keyed reads to pick up the xtra 2k geocodes using the 2000 census block as key--; proc datasets nolist library=user; modify xcodes2k; index create block2k=(county tract block); quit; *--this data step actually merges data from 3 sources: 1. Our 1990 blocks to 2000 census block correlation list. 2. Block-level geocodes from the 1990 stf1b data set for Mo. 3. (via keyed read) Block-level geocodes from the xcodes2k set that we created above. We need all these fields in order to generate the split-bg list in subsequent steps. --*; options mprint; data &pgm; merge corrlst.mobl902k(in=inclist drop=afact) stf901.moblks(in=instf901 keep=county cousubfp placefp tract urbarea urbanrur cd bg blk rename=(blk=block90) %renamel(county cousubfp placefp tract urbarea urbanrur cd bg,90)); by county90 tract90 block90; ***where county90 le '29003'; **********************************************************************; if not (inclist and instf901) then do; if pop90a=0 then delete; put '***Missing data: ' inclist= instf901= county90= tract90= block90=; _nbad+1; if _nbad gt 200 then abort abend; else delete; drop _nbad; end; set xcodes2k key=block2k/unique; *<---direct access read if additional 2k geocodes needed-; if _iorc_ then do; put _iorc_= county= tract= block= ' -- keyed read fails*****'; _nbad2+1; if _nbad2 gt 200 then abort abend; else delete; drop _nbad2; end; run; proc sort data=&pgm out=&pgm.s; by county90 cousubfp90 placefp90 tract90 Urbarea90 Urbanrur90 cd90 bg90 county cousubfp placefp tract UrbanRur bg; run; %corrwt(setin=&pgm.s,setout=corrlst.&pgm, g1=county90 cousubfp90 placefp90 tract90 Urbarea90 Urbanrur90 cd90 bg90, g2=county cousubfp placefp tract UrbanRur bg, wtvar=pop90a,keepwt=1) run; proc datasets library=corrlst nolist; modify &pgm (label='1990 Split-BG to 2K Split-BG, MO'); quit; options msglevel=i; *--And verify by match-merging it against the mosl090 dataset from stf3, 1990---; data unmatched matched(keep=county p1i1 afact ); merge stf903.mosl090(keep=county cousubfp placefp tract urbarea urbanrur cd bg p1i1 %renamel(county cousubfp placefp tract urbarea urbanrur cd bg,90) in=instf3 ) corrlst.&pgm(in=inclist); by county90 cousubfp90 placefp90 tract90 urbarea90 urbanrur90 cd90 bg90; if not (instf3 and inclist) then do; if instf3 and p1i1 = 0 then delete; _nbad +1; if _nbad gt 10 then stop; drop _nbad; put / '*** ' _all_; output unmatched; delete; end; output matched; run; proc sort data=matched; by county; run; %agg(setin=matched,setout=cntytots,aggby=county,aggvars=p1i1,facvar=afact,grand=1); proc print data=cntytots; run;