/* Use this code template for all future mable22 updates. It retains the MO-specific regions (in the mo_counties dataset). To use: 1. Make a copy of this program. 2. Create a dataset containing the geocodes and the field(s) needing updating / adding. This is T2. 3. Put the T2 dataset in the /data/mable22/updates directory. 4. Adjust the code below to pull the new / updated field(s) from T2, keeping all the other fields from T1 (the original). 5. Check the log for errors. 6. Delete the update dataset after succesful run. */ %include '/pub/sas/autoexec.sas'; options fmtsearch=(mable22 sasctlgs); options nosource nosource2 nomprint nomlogic nosymbolgen notes; libname mable22 '/pub/data/mable22'; libname updates '/pub/data/mable22/updates'; %macro doit(state,stab); proc sql; create table &stab._counties as select t1.State, t1.Stab, t1.County, t1.County3, t1.countySC, t1.Region, t1.Division, t1.CBSA20, t1.CBSAType20, t1.CSA20, t1.Metdiv20, t1.CBSA23, t1.CBSAType23, t1.CBSACentral23, t1.CSA23, t1.Metdiv23, t1.RUCC23, t1.LSAD, t1.FuncStat, %if &state = 29 %then %do; t1.MO_MERIC, t1.MO_RPC, t1.MO_DOT, t1.MO_UEX, t1.MO_AAA, %end; t1.CtyPop20, t1.CtyHUs from mable22.&stab._counties t1 left join updates.[county_additions_DS] t2 on (t1.GEOID = t2.GEOID); quit; data mable22.&stab._counties; set &stab._counties; run; proc sort; by county; run; * Create the views. ; data mable22.&stab.v/view=mable22.&stab.v; merge mable22.&stab._blocks mable22.&stab._counties ; by county; 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); %dostates(10 11); ========================== end comment */ %dostates(n=52);