x cd /pub/data/stf901x2/Tools; %let pgm=cnvtmoi_moblks; filename pgm "&pgm..sas"; *--Create stf901x2.moi from stf901.moi and stf901x2.moblks from stf901.moblks. Most of the work is done by the included stf901x2.sas module. This setup by J. Blodgett, OSEDA, 12-2001. Under contract with Mo Census Data Center. Being rerun 12-17-01 to fix problem with Asian1 variable. Original conversion was done in sf1990x.sas module in this lib, which is now obsolete (of historic interest only). In this run we convert data for the state of Missouri for governmental units on the moi data sets, and for the moblks block level set. Geography is left as is, i.e. 1990. (Other setups create tract, bg and block level sets but with 2000 geos.) --*; %libname(stf901); libname stf901x2 '/pub/data/stf901x2'; *============There are two major sections in this setup: First part converts selected observtions (summary levels) from moi Seconf part convert the moblks data set. =============*; *----------------------Part 1-------------------------------------------------------------*; %let state=29; %let geouniv=Missouri; %let geolevs=inventory summary levels; %let set=moi; data stf901x2.&set(label="Std 1990 STF1 Extract for &geouniv &geolevs"); *--this step adapted from the stf901x conversion code and creates vars consistent with stf901x filetype-; length slvl $3 geocode $16 default=4; set stf901.&set (rename=(slvl=sumlev)); *<----note that we do NOT keep tract and block group summaries. That is because we intend to use our 90 data allocated to 2k geography for those levels, i.e. we shall use the motrs00 and bobgs00 sets-; where sumlev in ('040' '050' '060' '155' '160' '500'); *--the following select group assigns the variable geocode based on values of slvl. note that it is critical that this code be consistent with that used in stf801x conversion so that we can match the data sets on geocode and slvl.; select (sumlev); when('040') do; if geocomp='00'; *<---omit other special geographic components; geocode=state; end; when('050') do; geocode=county; end; when('060') do; geocode=county||'-'||cousubfp; end; when('155') do; geocode=county||'-'||placefp; end; when('160') do; geocode=state||'-'||placefp; end; when('140') do; geocode=county||'-'||tract; end; when('150') do; geocode=county||'-'||tract||'-'||bg; end; when('500') geocode=state||'-'||cd; otherwise do; _nother+1; *--(not needed since we use a keep):drop _nother; if _nother le 5 then put _n_= sumlev= areaname= ' ***not processed'; delete; end; end; %include sascode(stf901x2)/source2; *<--this is also linked as stf901x2.sas in this Tools lib--; slvl=SumLev; keep areaname county placefp place cousubce cousubfp placesc placecc fipco cnty slvl; run; proc sort data=stf901x2.&set; by sumlev geocode; run; *------------Part 2-----------------------------------------------------------------------*; data stf901x2.moblks(label="Std 1990 STF1 Extract for Missouri census blocks" compress=yes); *--this step adapted from the stf901x conversion code and creates vars consistent with stf901x filetype-; length slvl $3 geocode $16 default=4; set stf901.moblks(rename=(slvl=sumlev)); where sumlev ='100'; *<=============================================; geocode=substr(county,3,3)||'-'||tract||'-'||blk; %include sascode(stf901x2)/nosource2; *<--this is also linked as stf901x2.sas in this Tools lib--; slvl=SumLev; keep county placefp place cousubce cousubfp tract bg blk urbanrur placesc placecc fipco cnty slvl; run; proc sort data=stf901x2.moblks; by sumlev geocode; run; proc datasets library=stf901x2 nolist; modify moblks; index create county; modify moi; index create sumlev; quit;