x cd /pub/data/sf32000x/Tools; %let pgm=slds2007_size_bystate; filename pgm "&pgm..sas"; /*---Generate report showing which states would be eligible to get ACS data at SLD levels. John Blodgett, OSEDA, U. of Missouri Outreach & Extension. Under contract with the Missouri Census Data Center. Running March, 2010 ---*/ libname sf3x "/pub/data/sf32000x/slds2007"; *----the dovar macro is where the work is actually done. Below, the included invoke_dovars.sas serves as the "driver" which invokes this macro once per variable. ---; data ; set sf3x.usslds(keep=state sumlev TotPop); by state sumlev; where totpop; if first.state then do; minsenate=999999; minhouse=999999; end; if sumlev='610' then if totpop < minsenate then minsenate=totpop; if sumlev='620' then if totpop < minhouse then minhouse=totpop; retain minhouse minsenate; if last.state then do; if minhouse < 20000 and minhouse then NoHouseState=1; if minsenate < 20000 and minsenate then NoSenateState=1; if minhouse >= 65000 then AnnualHouse=1; if minsenate>= 65000 then AnnualSenate=1; output; end; format state $state.; format minhouse minsenate comma12.; drop totpop sumlev; run; proc print; id State; sum Nohousestate--annualsenate; title 'Summary of States by Pop Size of Legislative Districts'; run;