x cd /pub/data/mable2k/Tools; %let pgm=popden_analysis; filename pgm "&pgm..sas"; *---look at some analysis of the pop density of areas in order that we can assign more useful values to the popden geographic indicator on mable2k. We are going to look at county subdivision -- MCDs -- with the presumption that they are defined everywhere and tend to be reasonable in size. When we ask whether a person lives in a sparse or densely settled area we think looking at persons per square mile in their MCD is a reasonably good measure. ---; libname mable2k '/pub/data/mable2k'; libname sf3x '/pub/data/sf32000x' access=readonly; *libname user '/SAS_temp/user'; *--the unistats macro is used to create a sas dataset with selected univariate measures by state with mcds as the unit of analysis. --; data mcddata; set sf3x.usmcds(keep=state geocode areaname totpop areasqmi poppersqm urban pcturban msacmsa); zeropop= (totpop=0); poppersqm=round(poppersqm); format state $fipstab.; run; options mprint; %unistats(data=mcddata, vars=poppersqm, by=state, out=mable2k.tempstats, stats=%str(n min p5 p10 q1 median q3 p90 p95 max mean),print=N) ; %unistats(data=mcddata, vars=poppersqm zeropop, out=usstats, stats=%str(n min p5 p10 q1 median q3 p90 p95 max mean),print=Y) ; proc print data=mable2k.tempstats; title "&pgm: Univariate Statistics for MCDs by State"; title2 "Population Density -- Persons Per Square Mile"; id state; run;