x cd /pub/data/bankdeps/Tools; %let pgm=mostats_bankdeps; filename pgm "&pgm..sas"; *---Generate the updated MOSTATS reports for MO counties with latest bank deposits data.---*; *---A ptr text file in /wwwhome/MOSTATS/Tools (on oseda AIX machine) tells you to come here for the setup.---; *--adapted from p:\shiva\bankdeps.sas (copy in MOSTATS/Tools) -- by J. Blodgett, 1/04--; %libname (bankdeps); libname georef '/pub/data/georef' access=readonly; libname popests '/pub/data/popests' access=readonly; %libname (sf12000x); data bankdeps; set bankdeps.mocnty90(in=in90) bankdeps.mocnty97(in=in97) bankdeps.mocnty00 (in=in00) bankdeps.mocnty03 (in=in03) bankdeps.mocnty04 (in=in04); by county date; if in90 and county='29000' then do; county=' '; areaname='Missouri'; end; if in90 then do; _ix=index(areaname,', MO'); if _ix then substr(areaname,_ix)=' '; end; ***if in03 and slvl='040' then date='30JUN03'd; ***if in99 and slvl='040' then date='30JUN99'd; if in97 then date='30JUN97'd; format date yymmdd10.; drop state cnty _ix; run; proc sort data=bankdeps; by county date; run; data merged; merge bankdeps (in=indata) georef.mocogeos(in=ingeos keep=county umx2); by county; if not(indata and ingeos) and slvl ne '040' then do; put / '******ERROR: Data missing during merge step****** ' / _all_; _nerr+1; if _nerr ge 10 then stop; drop _nerr; delete; end; proc sort data=merged; by date; run; proc rank data=merged(where=(slvl='050')) descending out=ranked; by Date ; var Deposits; ranks rank; run; proc sort data=ranked; by county date; run; proc sort data=merged; by county date; run; data final; merge merged(in=in1) ranked(in=in2); by county date; if not (in1 and in2) and slvl='050' then do; put '****final merge fails: ' _all_; stop; end; run; data popests; set popests.mocom99(keep=county popjl90 popjl97 slvl in=in90s) popests.mocom04(keep=county popjl00 popjl03 popjl04 sumlev rename=(sumlev=slvl) ); if county='29 ' then county=' '; if in90s then do; date='30JUN1990'd; pop=popjl90; output; date='30JUN1997'd; pop=popjl97; output; end; else do; date='30JUN2000'd; pop=popjl00; output; date='30JUN2003'd; pop=popjl03; output; date='30JUN2004'd; pop=popjl04; format date mmddyy6.; output; end; keep slvl county date pop; format date yymmdd10.; run; proc sort data=popests; by county date; run; %macro _dummy ; data pop2000; set sf12000x.moi; where sumlev='050' or geocode='29' and geocomp='00'; date ='01APR2000'd; pop=totpop; keep county date pop; run; data popests; set popests pop2000; by county; run; %mend _dummy; data finalpopests; merge final popests; by county date; countypercapdeposit=round ((Deposits/pop ),.001)*1000; format countypercapdeposit DOLLAR10.; run; proc sort data=finalpopests out=outpopests1; by date; run; proc rank data=outpopests1(where=(slvl='050')) out=outpopests descending; var countypercapdeposit; ranks rankcountypercapdeposit; by date; run; proc sort data=outpopests ; by county date; run; data finalrankedpopests; merge finalpopests outpopests; by county date; run; data statepop; set outpopests1; by date; if first.date then do; statepop90=pop; statedep=deposits; retain; end; countypcntpopstate=round((pop/statepop90)*100,0.01); countypcntdepositstate=round((deposits/statedep)*100,0.01);output; run; proc rank data=statepop(where=(slvl='050')) out=outstatepop descending; var countypcntpopstate; label countypcntpopstate='Pct of Missouri Population'; ranks rankpercapstate; by date; run; proc sort data=outstatepop; by county date; run; data finaloutstatepop; merge finalrankedpopests outstatepop; by county date; if umx2='CE' then umx2='CENTRAL EAST'; format umx2 $CHAR10.; run; proc sort data=finaloutstatepop; by umx2 county date; run; *-- creating data set for region data --; proc summary data=finaloutstatepop; class umx2 date; var deposits pop; output out=regiondata sum=deposits pop; run; *-- creating output for region data--; data outregiondata; set regiondata ; where date is not missing; regionpercapdeposit=round ((deposits/pop),0.001)*1000; format regionpercapdeposit DOLLAR10.2; regiondeposits=deposits; format regiondeposits DOLLAR14.2; drop _type_ _freq_ ; run; proc sort data=outregiondata; by date; run; data outregionpop; set outregiondata; by date; if first.date then do; regionpop=pop; statedeposit=deposits; retain; end; regionpcntpopstate=round((pop/regionpop)*100,0.01); regionpcntdepositstate=round((regiondeposits/statedeposit)*100,0.01);output; drop deposits; run; proc sort data =outregionpop; *-- final region data set ; by umx2 date; run; data finaldata; merge finaloutstatepop outregionpop; by umx2; attrib pop label='Population'; attrib rankcountypercapdeposit label='Rank for Per Capita Deposit'; attrib rank label='Rank for Deposit'; attrib countypercapdeposit label='Per Capita Deposit'; attrib countypcntdepositstate label='Percentage of Missouri Deposits'; attrib rankpercapstate label='Rank for Percentage of Missouri Deposits'; attrib regionpercapdeposit label='Per Capita Deposit Regions'; attrib regionpcntpopstate label='Percentage of Missouri Population(Region)'; attrib regionpcntdepositstate label='Percentage of Missouri Deposits(Region)'; attrib regiondeposits label='Region Deposits'; attrib regionpop label='Region Population'; run; proc sort data=finaldata; by county date; run; *-- remote submitting the code--; signon oseda; rsubmit ; proc upload data=finaldata status=no; proc upload data=outregionpop status=no; run; %macro yrindex; %*---assign the table indices based on calendar years of data---; when('1990') _j=1; when('1997') _j=2; when('2000') _j=3; when('2003') _j=4; when('2004') _j=5; %mend yrindex; *<==============================EDIT these each cycle!!!==========; proc format; value $regionx ' '=' ' 'CE'='Central' 'EC'='East Central' 'SW'='SouthWest' 'SE'='SouthEast' 'SC'='South Central' 'WC'='West Central' 'NW'='NorthWest' 'NE'='NorthEast'; value $regndx 'CE'=1 'EC'=2 'SW'=3 'SE'=4 'SC'=5 'WC'=6 'NW'=7 'NE'=8 ' '=9; *--data putout being created--; data putoutput; if _n_=1 then link loadtable; *--store the state and region totals in array data--; array DATA{9,5,5} _temporary_; length _j 8; length _rdx 8; set finaldata ; *****????**** (obs=21); by county; if county='29510' then areaname="St. Louis (City)"; areaname=compress(areaname,'.'); retain fv '/wwwhome/MOSTATS/Missouri/Counties/bankdeps. '; if slvl='040' then do; substr(fv,27)='States/bankdeps.Missouri.html'; end; else do; fv='/wwwhome/MOSTATS/Missouri/Counties/bankdeps. '; ***if slvl='040' then county='00000'; substr(fv,45)=(translate(trim(areaname),'_',' ')); fv=trim(fv)||'_MO.html'; end; file out filevar=fv ; _rdx=put(umx2,$regndx.); select(put(date,year4.)); %yrindex end; if first.county then do; put " Banking Deposits Data for Missouri Counties " / "

Missouri Census Data Center

"; put "

Bank Deposit Data for Missouri Counties

Geocode: " county $5. +1 "Areaname: " Areaname ", MO

"; put"
" / ""/ ""; put""; end; *--of initialization for current county--; else areaname=" " ; put ""; if rank<11 then put""; if rank>105 then put""; if (rank>10 & rank<106) then put""; put""; if rankcountypercapdeposit<11 then put""; if rankcountypercapdeposit>105 then put""; if (rankcountypercapdeposit>10 & rankcountypercapdeposit<106) then put""; put" "; if last.county then do; if umx2 NE ' ' then do; put "" ; **including table for Regions summary; put ""; put" " ; put ""; put" " ; put ""; put" " ; put ""; put" " ; put ""; put" " ; end; put"
Total Deposits Per Capita Deposits Percent of Missouri
Geographic Area Year Amount
($000)
Rank Amount Rank Population Deposits
" areaname" " date year4. " " deposits "" rank " " rank " " rank " " countypercapdeposit "" rankcountypercapdeposit " " rankcountypercapdeposit " " rankcountypercapdeposit " " countypcntpopstate " " countypcntdepositstate "

University of Missouri Extension Region
"umx2 $regionx. " 1990 " DATA{_rdx,1,1} DOLLAR14. " " " " DATA{_rdx,1,2} DOLLAR14. " " " " DATA{_rdx,1,3} " " DATA{_rdx,1,4} "
" " 1997 " DATA{_rdx,2,1} DOLLAR14. " " " " DATA{_rdx,2,2} DOLLAR14. " " " " DATA{_rdx,2,3} " " DATA{_rdx,2,4} "
" " 2000 " DATA{_rdx,3,1} DOLLAR14. " " " " DATA{_rdx,3,2} DOLLAR14. " " " " DATA{_rdx,3,3} " " DATA{_rdx,3,4} "
" " 2003 " DATA{_rdx,4,1} DOLLAR14. " " " " DATA{_rdx,4,2} DOLLAR14. " " " " DATA{_rdx,4,3} " " DATA{_rdx,4,4} "
" " 2004 " DATA{_rdx,5,1} DOLLAR14. " " " " DATA{_rdx,5,2} DOLLAR14. " " " " DATA{_rdx,5,3} " " DATA{_rdx,5,4} "
"; put"

Tables produced by Office of Social and Economic Data Analysis , UM-Columbia
"/ "SOURCE: Federal Deposit Insurance Corporation " "/ U.S. Bureau of the Census " "

The Missouri State Census Data Center Program is sponsored by the Missouri Secretary of State, Missouri State Library"/ " "; end; return; loadtable: do _tempx=1 to _noutreg; **** 27; set outregionpop nobs=_noutreg; length _j 8; select(put(date,year4.)); %yrindex end; _rdx=put(umx2,$regndx.); DATA(_rdx,_j,1)=regiondeposits; DATA(_rdx,_j,2)=regionpercapdeposit; DATA(_rdx,_j,3)=regionpcntpopstate; DATA(_rdx,_j,4)=regionpcntdepositstate; end; *--of _tmpx loop-; return; run; endrsubmit;