x cd /pub/data/georef/Tools; %let pgm=sumlevs; filename pgm "&pgm..sas"; *---Using the sf12000 geo headers file as source, create georef.sumlevs with the count and average 2000 population for the U.S. and each state. Accesses the data in the sf12010/xxgeos directory. JGB, 2-2002. ---*; %include '/pub/sas/autoexec.sas'; %libname(georef,opts=); libname xxgeos '/pub/data/sf12010x' access=readonly; libname user '/home/riceg/work' outrep=WINDOWS_32 outencoding='UTF-8'; ods html file='/pub/geography/reference/US_sumlevs-2010.html' style=sasweb; title "Summary of Geographic Summary Units Used in 2010 Census"; title2 height=1 "Counts and Average Populations of Selected Levels"; footnote "Report Producted by the Office of Social and Economic Data Analysis"; footnote2 "Under a Contract with the Missouri Census Data Center"; footnote3 "Source: Summary File 1, 2010 - Geographic Header Files"; footnote4 height=1 color="lightgrey" "Setup to Generate Report is in georef/Tools/sumlevs.sas"; %macro doit(state,stab); xxgeos.&stab.selectedinv %mend doit; data totabulate; set %dostates ; where sumlev in ('050','060','160','140','150','871'); if sumlev='871' then if substr(zcta5,4,2) in ('HH','XX') then delete; length default=4; select (sumlev); when ('050') Counties=pop100; when ('060') CountySubs=pop100; when ('140') Tracts=pop100; when ('150') BGs=pop100; when ('160') Places=pop100; when ('871') ZIPs=pop100; otherwise abort abend; end; format division $divisio. state $state.; keep division state Counties -- ZIPs; run; proc export data=totabulate outfile='/home/riceg/work/totabulate.csv' DBMS=CSV REPLACE; run; proc tabulate data=totabulate; class state division; var counties--zips; table all='U.S. Totals' Division State, (Counties CountySubs='County Subdivisions' Tracts Places='Places (Cities)' ZIPs='ZIP Codes (ZCTAs)') *(n='#'*f=comma7. mean='Avg Pop'*f=comma10.); run; ods html close;