x cd /pub/data/mable2k/Tools; %let pgm=genbbbbs; filename pgm "&pgm..sas"; *---Generate the mable2k.usbbbbs dataset with block based bounding box numbers for every state and county in the U.S. A bbbb consists of longmin, longmax, latmin, latmax coordinates in decimal degrees obtained by looking at the census block internal point coordinates. So these coordinates are NOT TRULY AN ENVELOPE for the areas but in terms of an application that places data within an area based on whether its internal point coords are in the area, these will be useful numbers. Our intent is to use them in point-and-radius apps where we can quickly rule out that any block, bg, mcd etc within a state/county can be within a specified distance of a specified point. Coded by John Blodgett, OSEDA, U of Missouri Outreach & Extension, April, 2003 ----; title1 "&pgm: Block Based Bounding Box Coords for U.S. States and Counties, 2000"; libname mable2k '/pub/data/mable2k'; libname user '/pub/data/moprofs/user'; data meansin; %macro doit(state,stab); mable2k.&stab.blks(keep=county intptlat intptlon) %mend doit; set %dostates(n=51) open=defer; length state $2; state=county; run; proc means data=meansin noprint; class state county; var intptlat intptlon; types state state*county; output out=bbbbs(drop=_freq_) min=minlat minlon max=maxlat maxlon; run; data mable2k.usbbbbs(index=(geocode)); length SumLev $3 geocode $5 stab $2 county $5 minlat maxlat minlon maxlon 8; set bbbbs; if _type_=2 then SumLev='040'; else SumLev='050'; if SumLev='040' then geocode=state; else geocode=county; stab=put(state,$fipstab.); format min: max: 11.6; drop _type_; run; proc print data=mable2k.usbbbbs; by sumlev state stab; id geocode; format county $county.; run;