x cd /pub/data/pl942000/Tools; %let pgm=tract_trends; filename pgm "&pgm..sas"; /* ----This report examine trends in population change at the tract level for metro areas in MO. John Blodgett, OSEDA, U. of Missouri Outreach & Extension. March, 2001. ---- */ options nodate linesize=132 pagesize=120 formdlim='=' noovp; libname user '/tmp/scratch/user'; libname corrlst '/pub/data/corrlst'; %libname(pl942000,opts=); %libname(pl9490,subdir=pl9490tx); title 'Tract Trends: Look at Tracts With Greatest Change over Decade of the 90''s'; options nodate; /*<=========================Comment out===================================== *------Part 1: get place names associated with tracts, creating corrlst.motr2plc------; proc sort data=pl942000.mogeos(where=(sumlev='740') keep=sumlev county tract placefp msacmsa pop100) out=aggin; by county tract placefp; run; %corrwt(setin=aggin,setout=tr2place,g1=county tract,g2=placefp,idvars=msacmsa,wtvar=pop100,keepwt=1); proc sort; by county tract pop100; run; data corrlst.motr2plc(label='2000 tract to primary place/location'); set tr2place; by county tract ; length Location $40; if first.tract then do; saveplc=' '; savepct=.; retain saveplc savepct; if last.tract then goto last1; end; if not last.tract then do; saveplc=placefp; savepct=afact; return; end; last1: length _arg $7; if placefp='99999' then do; if savepct > .1 then do; placefp=saveplc; _arg=substr(county,1,2)||saveplc; Location=put(_arg,$fplace.); end; else Location='Unincorporated area'; end; else do; _arg=substr(county,1,2)||placefp; Location=put(_arg,$fplace.); end; afact=afact*100; output; label placefp='Primary Place Code' afact='Pct of Tract Pop in Location' pop100='Pop in Tract/Location'; format afact 5.1 pop100 comma6.; drop saveplc savepct _arg; rename pop100=popinloc; run; proc print data=corrlst.motr2plc (obs=50) label; title2 'Partial Listing of corrlst.motr2plc'; by county; format county $county.; id tract; run; *---------Part 2: Merge the 90 and 2000 tract data to generate pl942000.motract_trends-----------*; data trpops90; set pl9490tx.motrs00; keep county tract totpop; rename totpop=totpop90; run; data pl942000.motract_trends(label='Change in Population, 1990-2000 for Missouri Census Tracts') ; merge trpops90(in=in90) pl942000.mogeos(in=in00 where=(sumlev='140') keep=sumlev county tract pop100 msacmsa) corrlst.motr2plc(in=inc keep=county tract Location ); by county tract; if not (in90 and in00 and inc) then do; put county= tract= in90= in00= inc=; _nbad+1; if _nbad ge 50 then stop; drop _nbad; end; change=pop100 - totpop90; if totpop90 then pctchange=100*change/totpop90; format change comma7. pctchange 7.1; run; *--------------Part 3: Generate Pop Change Reports at tract level for MO--------------------------; title 'Population Change Report: 1990 - 2000'; footnote 'Source; 1990 and 2000 Decennial Census'; footnote2 'Location indicates an area associated with the tract but not necessarily containing (all) of it'; footnote3 'Programming by OSEDA Under a Contract with the Missouri Census Data Center'; %let htmldir=%str(/pub/webrepts/popchange); %let htmlfile=Missouri_Tracts_by_MSA; ods html file="&htmldir/&htmlfile..html" ; title2 "Missouri Census Tracts Grouped by Metro Areas"; *include sascode('styles_default.sas')/nosource2; *---This modules sets the default html styles------; * ods printer pdf file="&htmldir/&htmlfile..pdf" author='MCDC' ; proc printto print="&htmldir/&htmlfile..txt" new; run; *ods listing close; title3 'Part 1G: Census Tracts with Greatest Population Gain (500 or more) By Metropolitan Area' ; %rankrpt(setin=pl942000.motract_trends,rankby=change,order=D,n2rank=25,byvars=msacmsa, idvars=county tract location,othvars=pop100 totpop90 pctchange,prntopts=label, minmax=500,ntitles=3) format msacmsa $metro.; label county='County' pop100='2000 Population' totpop90='1990 Population' change='Change in Population, 1990-2000' pctchange='% Change'; run; title3 'Part 1L: Census Tracts with Greatest Population Loss (100 or more) By Metropolitan Area' ; %rankrpt(setin=pl942000.motract_trends,rankby=change,order=A,n2rank=25,byvars=msacmsa, idvars=county tract location,othvars=pop100 totpop90 pctchange,prntopts=label, minmax=-100,ntitles=3) format msacmsa $metro.; label county='County' pop100='2000 Population' totpop90='1990 Population' change='Change in Population, 1990-2000' pctchange='% Change'; run; title3 'Part 2G: Census Tracts with Greatest Population Increase for Entire State' ; %rankrpt(setin=pl942000.motract_trends,rankby=change,order=D,n2rank=100,byvars=, idvars=county tract location,othvars=pop100 totpop90 pctchange,prntopts=label, minmax=500,ntitles=3) label county='County' pop100='2000 Population' totpop90='1990 Population' change='Change in Population, 1990-2000' pctchange='% Change'; run; title3 'Part 2L: Census Tracts with Greatest Population Loss for Entire State' ; %rankrpt(setin=pl942000.motract_trends,rankby=change,order=A,n2rank=25,byvars=, idvars=county tract location,othvars=pop100 totpop90 pctchange,prntopts=label, minmax=-100,ntitles=3) label county='County' pop100='2000 Population' totpop90='1990 Population' change='Change in Population, 1990-2000' pctchange='% Change'; run; ===========================End commented out================================ */ *--------------Part 4: Variation of Step 3 to deal with only tracts in Boone County --------------------------; title 'Population Change Report: 1990 - 2000'; footnote 'Source; 1990 and 2000 Decennial Census'; footnote2 'Location indicates an area associated with the tract but not necessarily containing (all) of it'; footnote3 'Programming by OSEDA Under a Contract with the Missouri Census Data Center'; data booneco; set pl942000.motract_trends; where county='29019'; run; %let htmldir=%str(/pub/webrepts/popchange); %let htmlfile=Boone_County_Tracts; ods html file="&htmldir/&htmlfile..html" ; * ods listing close; title2 "Boone County Census Tracts"; *include sascode('styles_default.sas')/nosource2; *---This modules sets the default html styles------; title3 'Part 1G: Census Tracts with With Population Gain of at Least 100 Persons, Ranked by Amount of Gain' ; %rankrpt(setin=booneco,rankby=change,order=D,n2rank=25,byvars=, idvars=county tract location,othvars=pop100 totpop90 pctchange,prntopts=label, minmax=100,ntitles=3) format msacmsa $metro.; label county='County' pop100='2000 Population' totpop90='1990 Population' change='Change in Population, 1990-2000' pctchange='% Change'; run; title3 'Part 1L: Census Tracts with Population Loss of 50 or More, Ranked by Amount of Loss' ; %rankrpt(setin=booneco,rankby=change,order=A,n2rank=100,byvars=, idvars=county tract location,othvars=pop100 totpop90 pctchange,prntopts=label, minmax=-50,ntitles=3) format msacmsa $metro.; label county='County' pop100='2000 Population' totpop90='1990 Population' change='Change in Population, 1990-2000' pctchange='% Change'; run; %include sascode(notify);