x cd /pub/data/stf903/Tools; %let pgm=moschls00_diagnostics; filename pgm "&pgm..sas"; *--Coded by John Blodgett, OSEDA, Nov 2002. Under contract with Mo Census Data Center. Diagnostic runs being done following the moschl00 run in order to try and identify problem with too-high numbers for some districts/counties. --*; libname stf903 '/pub/data/stf903'; libname user '/SAS_temp/user'; libname corrlst '/pub/data/corrlst' access=readonly; %libname(mable2k); %libname(stf901x2); %let sbg_geos=county cousubfp placefp tract UrbanRur bg ; *---2000 defn. The vars that correspond to sumlev 090--; %let sbg_geos_nour=county cousubfp placefp tract bg ; *---2000 defn. The vars that correspond to sumlev 090--; data aggin1(drop=cousubfp placefp tract UrbanRur bg ) unmatched1(keep=_character_ p1i1 pop90 compress=no); length State $2 ncescode $5 ; length default=5; retain SumLev 'sdu'; merge stf903.mosl090_00(keep=&sbg_geos _numeric_ in=instf3 ) sbg2k_sduni_wt90(in=inclist); by &sbg_geos; State=substr(county,1,2); if not (instf3 and inclist) then do; if instf3 and p1i1 = 0 then delete; if not instf3 and pop90=0 then delete; _nbad +1; ***if _nbad gt 100 then abort abend; drop _nbad; if instf3 or _nbad le 25 then put / '*** ' sumlev= instf3= inclist= p1i1= pop90= &sbg_geos; output unmatched1; delete; end; ncescode=sduni; if sduni='25230' and county ='29047' and abs(p3i1-898) le 2 then do; put /_all_; stop; end; * output aggin1; keep sumlev ncescode &sbg_geos state _numeric_; run; /*<=========================Comment out===================================== *---We want to focus on Clay county since it was off by almost 1000 total pop---; data aggin1ck; set aggin1(keep=pop90 afact county ncescode p3i1); where county='29047'; pop90ck=afact*p3i1; diff=pop90 - pop90ck; run; title 'aggin1ck: Aggregations from aggin1 dataset for Clay county'; proc tabulate data=aggin1ck; class county ncescode; var pop90 pop90ck diff; table all county*ncescode , (pop90 pop90ck diff)*sum*f=comma7.; format county $mocnty.; run; proc tabulate data=aggout; where sumlev='sdu' and county='29047'; class county ncescode; var p3i1; table county*(all ncescode), p3i1*(n sum); format ncescode $school.; title 'Aggregation of aggout obs where sumlev is sdu and county is Clay'; run; proc print data=stf901x2.moschlcos00(keep=sumlev geocode areaname totpop); where substr(geocode,7,5)='29047' and sumlev='su2'; title 'Extract from stf901x2.moschlcos00'; sum totpop; run; proc tabulate data=stf903.moschlcos00; var p3i1 pop90; class sumlev county; table sumlev*(all county), (p3i1 pop90)*(n*f=4. sum*f=comma9.); title2 'Table from stf903.moschlcos00'; run; ===========================End commented out================================ */