x cd /mscdc/data/stf903/Tools; %let pgm=txcnvt; %put &pgm; filename pgm "&pgm..sas"; title 'stf903/Tools/txcnvt: Create stf903.txi data set from 4 .xpt files ' 'created from cd-roms'; *--this "conversion" run accesses a set of 4 sas data sets created at ciesin using the stf3dbf macro against stf3 .dbf files obtained from lbl over internet. We eliminate the dup. summaries (for all levels except tract, bg and mcd) and create an index--; *--This setup is modeled after the one in the stf903x/Tools module of the same name. That one simply does the same thing for the stf903x (standard extract) versions of these sets; *--unlike the 903x conversion, we exit to execute the unzip commands to expand the zip archive files ftped from ciesin and we store these on /tmp/gaussian instead on /unitree. We will not keep these after the conversion has run successfully.--; /* *<===========already ran so commenting this unzip code out====== x cd /tmp/gaussian/tx; x unzip txi186.zip txi186.xpt &; x unzip txi187.zip txi187.xpt &; x unzip txi188.zip txi188.xpt &; x unzip txi189.zip txi189.xpt &; x cd /mscdc/data/stf903/Tools; ====================end commented out code======================= */ libname tx186 xport '/tmp/gaussian/tx/txi186.xpt'; libname tx187 xport '/tmp/gaussian/tx/txi187.xpt'; libname tx188 xport '/tmp/gaussian/tx/txi188.xpt'; libname tx189 xport '/tmp/gaussian/tx/txi189.xpt'; libname sasout '/unitree/mscdc/data/stf903'; *<----sort by summary level---; *--the where filters on all but the 1st set eliminates the redundant summaries for higher level geography, repeated on each cd-rom-; proc sort data=tx186.txi out=tx186; by slvl; proc sort data=tx187.txi (where=(slvl in ('060','140','150'))) out=tx187; by slvl; proc sort data=tx188.txi (where=(slvl in ('060','140','150'))) out=tx188; by slvl; proc sort data=tx189.txi (where=(slvl in ('060','140','150'))) out=tx189; by slvl; run; data sasout.txi(index=(slvl)); set tx186 tx187 tx188 tx189; by slvl; *--this is an "interleave"; if first.slvl then do; n=1; checkpop=p1i1; end; else do; n+1; drop n; if geocomp le '00' then checkpop+p1i1; drop checkpop; end; if last.slvl then do; file print; title2 'Counts by SLVL Showing Values for Last in Group'; put slvl= n= _n_= +1 areaname county= $fipcnty. county= $5. ; put 'Check total of pop figures for this level:' checkpop comma12.; end; run; proc contents short data=sasout.txi; run; data some/view=some; set sasout.txi; by slvl; if first.slvl then n=1; else n+1; drop n; if n le 5; *--keep up to 5 obs for each slvl--; run; proc print data=some(keep=_char_ p1i1 xcentrm ycentrm); by slvl; title2 'Listing of 5 obs per slvl'; run;