/* Generate the mable22 views used in the geocorr 2022 web application. This program merges two datasets created in previously run setups. */ %include '/pub/sas/autoexec.sas'; options fmtsearch=(mable22 sasctlgs); options source source2 mprint mlogic symbolgen notes; libname mable22 '/pub/data/mable22_new'; %macro doit(state,stab); /* This view combines (merges) the block-level and county-level data. */ data mable22.&stab.v/view=mable22.&stab.v; set mable22.&stab._blocks(in=inblks1) ; by county ; if first.county then set mable22.&stab._counties(rename=(county=countyck)); if county ne countyck then do; put "Error: county code on &stab._counties dataset does not match that on the blocks datasets****" county= countyck=; stop; end; if not (inblks1) then do; _missingbdata+1; *-- we allow missing data for the 2010 data. There are a few in each state. ; if _missingbdata le 100 then put "Missing data for block: " inblks1= county= tract= block=; else abort abend; end; drop countyck; drop _: ; run; *-- Write a record to end of cnvtlog.txt documenting what we just did. ; data _null_; set mable22.&stab._blocks (obs=3) nobs=_nobs; file "cnvtlog.txt" mod; if _n_=1 then put "Conversion for &stab&state complete on &sysdate at &systime . Census blocks processed: " _nobs; *put / _all_ / ; stop; run; %mend doit; /* begin comment ==================================== %dostates(01 02 04 05 06 08 09 10 11 12 13 15 16 17); %dostates(18 19 20 21 22 23 24 25 26 27 28 29 30 31); %dostates(32 33 34 35 36 37 38 39 40 41 42); %dostates(44 45 46 47 48 49 50 53 54 55 56); %dostates(51 72); ========================== end comment */ %dostates(n=52);