x cd /pub/data/georef/Tools; %let pgm=zips_bysize_andurbrural; filename pgm "&pgm..sas"; *---Generate a table showing ZIP code pop categories by urban/rural classification. Hypothesis: The great majority of ZIP codes are small and rural. But most people live in the ones that are large and urban. ---*; libname georef '/pub/data/georef' access=readonly; data report; set georef.zcta_master(keep=zcta5 pop2k pcturban state medianhhinc); where pop2k and substr(zcta5,3,2) not in ('XX','HH'); popinK=int(pop2k/1000); if pcturban ge 75 then UrbanRural='Urban'; else if pcturban lt 25 then UrbanRural='Rural'; else UrbanRural='Mixed'; keep pop2k popink urbanrural medianhhinc; run; proc format; value popcat 0-1=' 0-1999' 2-3='2000-3999' 4-5='4000-5999' 6-9='6000-9999' 10-15='10000-15999' 16-19='16000-19999' 20-30='20000-29999' 30-high='30000+'; run; title 'U.S. ZIP Codes (ZCTAs) 2000: Urban Rural Breakdown by Population Size'; footnote 'A ZIP is urban or rural if 75% if its pop is urban or rural. Otherwise it is Mixed'; ods html file="&pgm..html"(title="Urban and Rural ZIPs") style=sasweb; options nodate; proc tabulate data=report; class popink urbanrural; var pop2k; label popink='Pop Interval'; format popink popcat.; table popink all='Total', (all urbanrural)*(pop2k=' '*(n="# ZIPs"*f=comma7. sum="Population"*f=comma11.)); run; ods html close; proc univariate data=report; var medianhhinc; run;