x cd /pub/data/corrlst/Tools; %let pgm=puma2k_puma10; filename pgm "&pgm..sas"; *---Using the Geocorr14 data we create an equivalency data set for the US showing relationship of the old 2k PUMAs vs the new 2010 (aka "2012" PUMAs: we like 2012 because the ACS data for vintage 2012 was when they were first used for tabulating ACS data). We want to create average allocation factors for all the 2012 PUMAs as a measure of how good the allocation (of data at the 2000 PUMA level to 2010 PUMA level) may be. ---*; %let clistset=uspuma2k_puma10; libname corrlst '/pub/data/corrlst'; filename csvin '/pub/data/corrlst/uspuma2k_puma10.csv'; *--from geocor14 run 3-10-16 relating puma2k to puma12--; %libname(mable14); options fmtsearch=(work mable14 sasctlgs); *--So we can access the $puma12 format code to assign arename--; /*<=========================Comment out===================================== data corrlst.&clistset (label="2000 PUMA to 2010/2012 PUMA wtd by 2010 Pop" compress=yes); infile csvin dsd firstobs=3 missover ; length State $2 puma2k $5 puma10 $5 pop10 5 afact 8; input state--afact; length Areaname $80; length _arg $7; _arg=state||puma10; Areaname=put(_arg,$puma.); *--format table lookup--; drop _: ; run; ===========================End commented out================================ */ proc sort data=corrlst.&clistset out=sorted; by state puma10; run; data corrlst.&clistset.AvgAfacts; set; by state puma10; if first.puma10 then do; PopWtd=0; SumTotpop=0; end; if first.state then do; PopWtdState=0; SumTotpopState=0; _NexactState=0; end; TotPopWeighted=Pop10*afact; PopWtd+TotPopWeighted; SumTotpop+Pop10; if last.puma10 then do; PopWtdState + PopWtd; SumtotpopState+sumtotpop; Avgafact=PopWtd/Sumtotpop; format Avgafact 6.3; if Avgafact ge .99 then do; nexact=1; _NexactState+1; end; output; end; if last.state then do; puma10= ' '; areaname=trim(put(state,$state.))|| 'Average'; popWtd=PopWtdState; avgafact=PopwtdState/SumtotpopState; NexactState=_Nexactstate; output; end; keep state puma10 Avgafact nExact nExactState Areaname; run; proc print data = corrlst.&clistset.AvgAfacts(drop=neactstate); by state; where state='29'; *<===; id puma10; title2 "Average Allocation Factors Going from 2000 PUMA to 2010 PUMA"; run cancel; title2 "Summary Report by State and Nation Showing Average Allocation Factors"; proc tabulate data=corrlst.&clistset.AvgAfacts (where=(puma10 ne ' ')); class State ; format state $state.; var AvgAfact Nexact; table State all="US Totals", NExact='# Exact'*sum=' '*f=7. AvgAfact*(n="# PUMAs"*f=3. mean="Avg Afact" min="Min AvgAfact" q1 median q3 max); run;