x cd /pub/data/sf32000x/Tools; %let pgm=cnvtsf3x_movtds; filename pgm "&pgm..sas"; /* ---Create sf32000x.movtds--- ---*/ %let setin=movtds; %let dvmode=data; *--required by dovar macro which is invoked dozens of times by the invoke_dovars module--; title "&pgm: Create sf32000x Extract Datasets from sf32000 Datasets"; libname sf3 "/pub/data/sf32000" access=readonly; libname sf3x "/pub/data/sf32000x"; options NOmprint; /* =======================Begin comment================ *---------Here is the conversion data step-------------*; data sf3x.movtds (label='Missouri Voting Tabulation Districts'); length default=5 Obs 5 esriid $11 vtd $6; merge sf3.&setin.ph sf3.&setin.phct(in=inct); * by logrecno; *---these 2 filters added 3-26-03---; *-----No key used -- we merge obs by obs, dangerous!!!!!!!!!!!!!!!!!!!!---; label esriid='Id field to link to ESRI map files'; %include 'invoke_dovars.sas'/source2; esriid=compress(geocode,'-.'); grcid=esriid; Obs+1; label grcid='Id field to link to GRC/MsDIS map files (Mo only)'; keep Obs esriid geocode vtd sumlev areaname county ; keep TotPop -- grcid landsqmi;; label Obs='Observation #'; run; proc print data=sf3x.movtds(where=(county='29019')); title2 'First 100 Obs from sf3x.movtds'; by SumLev notsorted; id sumlev; var geocode esriid vtd areaname totpop; run; ======================End comment================== */ data sf3x.boonevtds; length precinct $2 Ward $1; label Ward='Ward (city of Columbia)'; set sf3x.movtds(where=(county='29019')); precinct=compress(substr(areaname,5),' *'); *--E.g. "VTD 12*" results in "12" --; *--if the precinct code ends with an alpha then the 1st digit is the Ward (city of Columbia only)---; if index('ABCDEFGHIJKLMNOP',substr(precinct,2,1)) then Ward=substr(precinct,1,1); put areaname= precinct= ward=; label precinct='Boone Co Precinct or Voting District'; run; proc means n sum maxdec=0 data=sf3x.boonevtds; title "Summaries by Columbia Wards"; class ward; var totpop; run;