%include '/pub/sas/autoexec.sas'; libname source '/data/pl942020'; libname pops '/data/acs2021/temp'; libname acs '/data/acs2021'; options compress=binary; /* data pops.tracts; set %macro doit(state,stab); source.&stab.sums (keep=geoid totpop sumlev) %mend doit; %dostates(n=51) ; where SumLev='140'; length esriid $16 ; esriid = substr(geoid,8); drop SumLev geoid; rename totpop=TotPop20; run; proc sort; by esriid; run; data pops.bgs; set %macro doit(state,stab); source.&stab.sums (keep=geoid totpop sumlev) %mend doit; %dostates(n=51) ; where SumLev='150'; length esriid $16 ; esriid = substr(geoid,8); drop SumLev geoid; rename totpop=TotPop20; run; proc sort; by esriid; run; proc sort data=acs.ustracts5yr force; by esriid; run; proc sort data=acs.usbgs5yr; by esriid; run; data acs.ustracts5yr; merge acs.ustracts5yr pops.tracts; by esriid; run; data acs.usbgs5yr; merge acs.usbgs5yr pops.bgs; by esriid; run; data acs.ustracts5yr; retain SumLev geoid esriid AreaName State Stab County Tract CBSA cbsaType metdiv CSA LandSqMi AreaSqMi INTPTLAT intptlon CBSAYr vintage period LogRecno FipCo CongDist DateCreated TotPop20 ; set acs.ustracts5yr ; label TotPop20 = '2020 Census total population'; run; */ proc datasets nolist library=acs; modify ustracts5yr; index create state; index create county; quit; /* data acs.usbgs5yr; retain geoid SumLev areaname esriid Stab State County tract bg vintage period DateCreated LogRecno LandSqMi AreaSqMi INTPTLAT INTPTLON TotPop00 TotPop10 TotPop20 TotHHs10 ; set acs.usbgs5yr ; label TotPop20 = '2020 Census total population'; run; */