x cd /pub/data/stf901x2/Tools; %let pgm=us; filename pgm "&pgm..sas"; *---Run by JGB, 11-17-01. Create 1990 stf1 std extract for US basic geographies from the 1990 STF1C data set. Creates: ---> stf901x2.us Rerun 12.17.01 to fix Asian1. ---*; %libname(stf901); libname stf901x2 '/pub/data/stf901x2'; data stf901x2.us(label='US Summaries for Basic National Geography'); length sumlev $3 geocode $16 areaname $48; set stf901.us(rename=(slvl=sumlev)); where geocomp='00'; *--the following select group assigns the variable geocode based on values of slvl (rename to sumlev for compatibility with 2000 data sets). Note that it is critical that this code be consistent with that used in sf12000 conversion so that we can match the data sets on geocode and sumlev. Note also that the Census Bureau just changed a lot of codes for no apparent reason. What was 061 in 1990 is 060 in 2000 and what was 300 in 1990 is now 380. --*; select (sumlev); when('010') geocode=' '; when('020') geocode=reg; when('030') geocode=div; when('040') geocode=state; when('050') do; geocode=county; end; when('061') do; sumlev='060'; geocode=county||'-'||cousubfp; end; when('161') do; sumlev='160'; geocode=state||'-'||placefp; end; when('300') do; sumlev='380'; geocode=msacmsa; end; when('301') do; sumlev='385'; geocode=pmsa; end; when('310') do; sumlev='381'; geocode=msacmsa||'-'||state; areaname=put(msacmsa,$metro.); if substr(areaname,length(areaname)-3,4) ne ', '||stab then areaname=trim(areaname)||' - '||stab || ' part'; end; when('311') do; sumlev='386'; geocode=pmsa||'-'||state; areaname=put(pmsa,$metro.); if substr(areaname,length(areaname)-3,4) ne ', '||stab then arename=trim(areaname)||' - '||stab || ' part'; end; otherwise delete; end; *--the select statement--; %include sascode(stf901x2); *<---the basic transformation takes place here-------------; keep areaname state stab fipco county cnty place placefp cousubfp msacmsa pmsa intptlng intptlat areasqmi reg div; run; proc sort data=stf901x2.us; by sumlev geocode; run; proc datasets library=stf901x2 nolist; modify us; index create sumlev; index create state; quit; *---Create a sample of the sumlevs and list---; data sumlevs; set stf901x2.us(keep=sumlev geocode areaname TotPop); by sumlev; if first.sumlev then n=1; else n+1; if n le 10; drop n; run; proc print data=sumlevs; by sumlev; id sumlev; title2 'Listing of Up to 10 Observations for Each SumLev Value on stf901x2.us'; run;