x cd /pub/data/mable2k/Tools; %let pgm=state_metro_popden_analysis; filename pgm "&pgm..sas"; *--Do an analysis of the distribution of population within states and metro areas by the 4-value popden category (empy, low, medium and high). For the entire U.S. This is similar to what geocorr2k can do but this is somewhat faster and more sophisticated. John Blodgett, May, 2002. --*; %libname(mable2k); title "State and Metro Area Population Density Analysis"; title2 "Based on Data in the MABLE2K Data Base -- 2000 Census Geography and Pop Counts"; footnote "Report Produced by the Missouri Census Data Center"; footnote "Access mable2k using geocorr2k web app.: https://mcdc.missouri.edu/applications/geocorr2000.html"; libname user '/SAS_temp/user'; %macro setname(state,stab); mable2k.&stab.v %mend setname; /*<=========================Comment out===================================== data popdenblks; set %dostates(01 09,mac=setname,msgs=1) open=defer end=_last; if landsqmi then if pop2k then poppsqmi=pop2k/landsqmi; else poppsqmi=0; format poppsqmi best8.; keep state msacmsa popden pop2k landsqmi poppsqmi; run; proc sort; by state msacmsa popden; run; %agg(aggin=popdenblks, aggout=temp1&pgm, aggby=state msacmsa popden, aggvars=pop2k landsqmi poppsqmi, means=poppsqmi, mweights=landsqmi, agglvl=1) run; ===========================End commented out================================ */ proc format; value $metcat '9999'='Non_metro' '0001'-'9998'='Metro'; run; proc tabulate data=temp1&pgm ; class state msacmsa popden; var pop2k landsqmi poppsqmi; format msacmsa $metcat.; table all="U.S. Totals" msacmsa="Metro Cat" state , (all='All Areas' popden='Density Category')*(pop2k*sum*f=comma9. landsqmi*sum*f=comma9.) ; title3 "Report 1: Summary by Entire U.S. and States by Metropolitan Category"; run;