x cd /pub/data/pl9490/Tools; %let pgm=pl94trend_90geog_XX; filename pgm "&pgm..sas"; *---This setup will generate sas datasets in the pl9490tx subdirectory of pl9490 for varying states. These sets are suitable for use as input to the pl94 trend reports that allow juxtaposing basic pl94 pop data for 1990 and 2000. This setup generates data where we use the 1990 geography. Other more complex jobs will be used to generate data converted to 2000 geocodes. jgb, 3-14-01. ---*; libname pl9490 '/pub/data/pl9490' access=readonly; libname pl9490tx '/pub/data/pl9490/pl9490tx'; %let stab=ks; %let state=20; *<=====================Creating data sets for Kansas===; %let stab=il; %let state=17; *<=====================Creating data sets for Illinois=; %macro concatd(g1,g2,g3,g4,g5,g6,g7); %*--utility macro to return a SAS expression that will be the concatenation of specified char variables separated by dashes-; %local dash gc; %let dash=%str(||'-'||); %*--we build the value of local variable gc which is then "returned" as the result of invoking the macro-; %let gc=&g1; %if &g2= %then %goto rtrn; %let gc=&gc&dash&g2; %if &g3= %then %goto rtrn; %let gc=&gc&dash&g3; %if &g4= %then %goto rtrn; %let gc=&gc&dash&g4; %if &g5= %then %goto rtrn; %let gc=&gc&dash&g5; %if &g6= %then %goto rtrn; %let gc=&gc&dash&g6; %if &g7= %then %goto rtrn; %let gc=&gc&dash&g7; %rtrn: &gc %mend concatd; *--------Generate data for state, county, mcd and place with unchanged geography (i.e. 1990 geography)--; data pl9490tx.&stab.stcnty pl9490tx.&stab.plac90(label='Place Data Using 90 Geography') pl9490tx.&stab.mcds90(label='MCD Data Using 90 Geography'); set pl9490.&stab.nblks; *--for Kansas, Missouri and Illinois we separated out "non-block" summaries-; where slvl in ('040','050','060','160'); *--borrow code from that used to create the 2k pl94 data sets--; length default=5; *block=blk; SumLev=slvl; *--Same item, new name--; length geocode $32; select(SumLev); *---Assign the standardized Geographic Code to uniquely ID the geographic area--; * when('750') geocode=%concatd(county,vtd,tract,block); * when('740') geocode=%concatd(county,vtd,cousubfp,placefp,tract,bg); * when('700') geocode=%concatd(county,vtd); * when('620') geocode=%concatd(state,sldu); * when('610') geocode=%concatd(state,sldl); * when('500') geocode=%concatd(state,cd); * when('172') geocode=%concatd(state,concit,placefp); * when('170') geocode=%concatd(state,concit); when('160') geocode=%concatd(state,placefp); * when('140') geocode=%concatd(county,tract); when('060') geocode=%concatd(county,cousubfp); when('050') geocode=county; when('040') geocode=state; otherwise do; *<====We have not yet done code for the various Alaskan and Indian geo levels--; if '280' le SumLev le '285' then geocode=' '; else put '****Unexpected SumLev code encountered: No value assigned to geocode: ' SumLev= areaname=; abort 500; end; end; *--select group--; *--assign all the vars to corresponding names used in the pl94-2000 mosums data set(s)--; totpop=p1i1; white1=p2i1; black1=p2i2; indian1=p2i3; asianpi=p2i4; *--NOT the same as a 1990 category-; other1=p2i5; whovr181=p3i1; blovr181=p3i2; inovr181=p3i3; aspovr18=p3i4; otovr181=p3i5; over18=sum(of p3i1-p3i5); hisppop=p4i1; whitenh1=p4i2; hisovr18=p5i1; wnovr181=p5i2; if sumlev in ('040','050') then output pl9490tx.&stab.stcnty; else if sumlev='060' then output pl9490tx.&stab.mcds90; else if sumlev='160' then output pl9490tx.&stab.plac90; else do; put //'***Logic Error - Unexpected sumlev value: ' /_all_; abort 700; end; label totpop='1990 complete count pop'; keep areaname state county sumlev geocode totpop -- wnovr181; *--only keep mostly the new variable (names)--; run;