x cd /pub/data/sf12000x/Tools;  %let pgm=query_racebynewlds;  filename pgm "&pgm..sas";
*--Special query: genreate set with race and hispanic pop counts for all blocks in 189 and with
 new mo leg dist codes.--;
libname sf12000x '/pub/data/census_2000/sf12000x' access=readonly;
libname georef '/pub/data/georef' access=readonly;

filename dlmout '/pub/data/temp/blks189.csv';


proc sort data= sf12000x.moblks(keep=county tract block totpop totpop90
   white1 black1 indian  asian1 hawnpi1 other1 multrace hisppop where=(county='29189' and totpop)) out=sf1x;
   by tract block;
   run;
data blks189;
 merge georef.moblks00(in=ing keep=county tract block sldl02 sldu02 cd108  pop100)
   sf1x(in=ind);
  by county tract block;
 where county='29189';
 drop county pop100;
 if not (ing and ind) then do;
 if not ind and pop100=0 then return;
 put ing= ind=  tract= block=;
 delete;
 end;
 rename sldu02=Senate sldl02=House;
  run;

%cnvtdlm(setin=blks189,names=1,missval=null,hquotes=0,quotes=0)

data _null_;
  infile dlmout obs=25;
 input; list;
 run;


