*---------/mscdc/data/stf903/Tools/cksl140.sas----------*; x cd /mscdc/data/stf903/Tools; options mprint; %pgm(cksl140) options nomprint; /* Verify that the stf903 tract by state slvl140.bystate data matches tracts in the stf903x slvl150.bystate block group data. JWS 7/97 */ libname slvl140 '/mscdc/data/stf903/slvl140.bystate'; libname slvl150 '/mscdc/data/stf903x/slvl150.bystate'; %macro slvl140(stfips=); %*<----2-digit state-------------; %local err; %let err=0; %if %length(&stfips) ne 2 %then %let err=1; %let stab=%stcnvt(&stfips); %if &stfips=01 %then %let state=Alabama; %else %if &stfips=02 %then %let state=Alaska; %else %if &stfips=04 %then %let state=Arizona; %else %if &stfips=05 %then %let state=Arkansas; %else %if &stfips=06 %then %let state=California; %else %if &stfips=08 %then %let state=Colorado; %else %if &stfips=09 %then %let state=Connecticut; %else %if &stfips=10 %then %let state=Delaware; %else %if &stfips=11 %then %let state=Washington DC; %else %if &stfips=12 %then %let state=Florida; %else %if &stfips=13 %then %let state=Georgia; %else %if &stfips=15 %then %let state=Hawaii; %else %if &stfips=16 %then %let state=Idaho; %else %if &stfips=17 %then %let state=Illinois; %else %if &stfips=18 %then %let state=Indiana; %else %if &stfips=19 %then %let state=Iowa; %else %if &stfips=20 %then %let state=Kansas; %else %if &stfips=21 %then %let state=Kentucky; %else %if &stfips=22 %then %let state=Louisiana; %else %if &stfips=23 %then %let state=Maine; %else %if &stfips=24 %then %let state=Maryland; %else %if &stfips=25 %then %let state=Massachusetts; %else %if &stfips=26 %then %let state=Michigan; %else %if &stfips=27 %then %let state=Minnesota; %else %if &stfips=28 %then %let state=Mississippi; %else %if &stfips=29 %then %let state=Missouri; %else %if &stfips=30 %then %let state=Montana; %else %if &stfips=31 %then %let state=Nebraska; %else %if &stfips=32 %then %let state=Nevada; %else %if &stfips=33 %then %let state=New Hampshire; %else %if &stfips=34 %then %let state=New Jersey; %else %if &stfips=35 %then %let state=New Mexico; %else %if &stfips=36 %then %let state=New York; %else %if &stfips=37 %then %let state=North Carolina; %else %if &stfips=38 %then %let state=North Dakota; %else %if &stfips=39 %then %let state=Ohio; %else %if &stfips=40 %then %let state=Oklahoma; %else %if &stfips=41 %then %let state=Oregon; %else %if &stfips=42 %then %let state=Pennsylvania; %else %if &stfips=44 %then %let state=Rhode Island; %else %if &stfips=45 %then %let state=South Carolina; %else %if &stfips=46 %then %let state=South Dakota; %else %if &stfips=47 %then %let state=Tennessee; %else %if &stfips=48 %then %let state=Texas; %else %if &stfips=49 %then %let state=Utah; %else %if &stfips=50 %then %let state=Vermont; %else %if &stfips=51 %then %let state=Virginia; %else %if &stfips=53 %then %let state=Washinton; %else %if &stfips=54 %then %let state=West Virginia; %else %if &stfips=55 %then %let state=Wisconsin; %else %if &stfips=56 %then %let state=Wyoming; %else %let err=1; %if &err %then %do; %put ***Required stfips parameter must be a valid FIPS; %put state code. Value specified is not: stfips=&stfips ; %put Macro aborting..... ; %goto endmac; %end; %else %put ***Processing tracts for &state....; proc freq data=slvl150.&stab.bgs(keep=county tract); by county; tables tract /out=&stab.bgtrs noprint; run; data differs;retain stab "&stab";length source $7; merge slvl140.&stab.tracts(keep=county tract in=slvl140) &stab.bgtrs(keep=county tract in=slvl150); by county tract; if not slvl150 or not slvl140; if slvl150 then source='slvl150'; else source='slvl140'; run; %let diffobs=0; data nobs;set differs nobs=diffobs; call symput('diffobs',left(diffobs)); stop; run; %put diffobs= &diffobs; %if &diffobs ne 0 %then %do; proc append base=compare data=differs;run; %end; %if %str(&stab)=%str(wy) %then %do; proc print data=compare;by stab notsorted;id stab; title 'Tracts transferred from CIESIN STF903 Export Archive which differ'; title2 'From Tracts in Block Groups in the STF903x Directory (slvl150)'; run; %end; %put ...&state processing completed***; %endmac: %mend slvl140; %slvl140(stfips=01); %slvl140(stfips=02); %slvl140(stfips=04); %slvl140(stfips=05); %slvl140(stfips=06); %slvl140(stfips=08); %slvl140(stfips=09); %slvl140(stfips=10); %slvl140(stfips=11); %slvl140(stfips=12); %slvl140(stfips=13); %slvl140(stfips=15); %slvl140(stfips=16); *slvl140(stfips=17); %slvl140(stfips=18); %slvl140(stfips=19); %slvl140(stfips=20); %slvl140(stfips=21); %slvl140(stfips=22); %slvl140(stfips=23); %slvl140(stfips=24); %slvl140(stfips=25); %slvl140(stfips=26); %slvl140(stfips=27); %slvl140(stfips=28); %slvl140(stfips=29); %slvl140(stfips=30); %slvl140(stfips=31); %slvl140(stfips=32); %slvl140(stfips=33); %slvl140(stfips=34); %slvl140(stfips=35); %slvl140(stfips=36); %slvl140(stfips=37); %slvl140(stfips=38); %slvl140(stfips=39); %slvl140(stfips=40); %slvl140(stfips=41); %slvl140(stfips=42); %slvl140(stfips=44); %slvl140(stfips=45); %slvl140(stfips=46); %slvl140(stfips=47); %slvl140(stfips=48); %slvl140(stfips=49); %slvl140(stfips=50); %slvl140(stfips=51); %slvl140(stfips=53); %slvl140(stfips=54); %slvl140(stfips=55); %slvl140(stfips=56); RUN; run;