x cd /pub/data/sf12010x/Tools; %let pgm=usblocks; filename pgm "&pgm..sas"; *******************************OBSOLETE. This was not a great idean. The views were never used and the indices created were somehow lost and had to be redone as an extra step in the bounding box extract late in 2016. Pretend this never happened. ************************************; *---Two key things being done here: 1. Generate ctb indices (county, tract, block) for all states. (Before was just for Missouri). 2. Generate a view that concatenates state-level XXblocks data sets using these new indices they come out sorted by county, tract and block. jgb, 6-27-15. ---*; libname sf12010x '/pub/data/sf12010x'; /*<=========================Comment out===================================== %macro doit(state, stab); %if &state ne 29 %then %do; %*--Because we already have it for MO--; modify &stab.blocks; index create ctb=(county tract block); %end; %mend doit; proc datasets library=sf12010x nolist; %dostates(n=51); quit; ===========================End commented out================================ */ %macro dset(state,stab); sf12010x.&stab.blocks (idxname=ctb) %mend dset; %let setname=alfl_blocks_byctb; %let states=Alabama thru Florida; data sf12010x.&setname(label="Blocks in &states st-co-tract-blk order")/view=sf12010x.&setname; set %dostates(01 02 04 05 06 08 09 10 11 12,mac=dset); ** open=defer; ** by state; run; %let setname=game_blocks_byctb; %let states=Georgia thru Maine; data sf12010x.&setname(label="Blocks in &states st-co-tract-blk order")/view=sf12010x.&setname; set %dostates(13 15 16 17 18 19 20 21 22 23,mac=dset); ** open=defer; run; %let setname=mdnh_blocks_byctb; %let states=Maryland thru New Hampshire; data sf12010x.&setname(label="Blocks in &states st-co-tract-blk order")/view=sf12010x.&setname; set %dostates(24 25 26 27 28 29 30 31 32 33,mac=dset); ** open=defer; run; %let setname=njri_blocks_byctb; %let states=New Jersey thru Rhode Island; data sf12010x.&setname(label="Blocks in &states st-co-tract-blk order")/view=sf12010x.&setname; set %dostates(34 35 36 37 38 39 40 41 42 44,mac=dset); ** open=defer; run; %let setname=scwy_blocks_byctb; %let states=South Carolina thru Wyoming; data sf12010x.&setname(label="Blocks in &states st-co-tract-blk order")/view=sf12010x.&setname; set %dostates(45 46 47 48 49 50 51 53 54 55 56,mac=dset); ** open=defer; run; data _null_; set sf12010x.&setname end=last; by county ; where state='15'; if first.county then nblocks=1; else nblocks+1; if last.county then put county= nblocks=; if last then put / _all_; run ;