x cd /pub/data/popests/Tools; %let pgm=dmig_report_mocos; filename pgm "&pgm..sas"; /*----Access the latest county level domestic and total migration data for MO . April, 2006: Running with the 2005 data. Modeled after dmig_report_states. ------*/ %let year=2005; *<=================EDIT EACH TIME=============; %let yr=%substr(&year,3,2); %let yrm1=0%eval(&yr - 1); %let yrm2=0%eval(&yr - 2); libname popests '/pub/data/popests'; data dmigtrends; set popests.mocom&yr(where=(sumlev='050') keep=state county areaname dmig: dommig sumlev); *---For consistency with Bureau report we ignore the quarter change from April to June 2000 and just look at annualized change from July 1 2000 to whatever year. ---; dmig00&yrm1._tot= DomMig - dmigaj00 - dmig&yrm1&yr; dmig00&yrm1._avg= round( dmig00&yrm1._tot/&yrm1); label dmig00&yrm1._tot="Total Domestic Mig 7/1/00 to 7/1/&yrm1" dmig00&yrm1._avg="Avg Annual Domestic Mig 7/1/00 to 7/1/&yrm1"; TrendChange=dmig&yrm1.&yr - dmig&yrm2&yrm1; *--compare the net domestic change in the most recent year with that of the previous year--; dmig00&yr._tot= dmig00&yrm1._tot + dmig&yrm1.&yr; dmig00&yr._avg=round( dmig00&yr._tot/&yr ); label dmig00&yr._tot="Total Domestic Mig 7/1/00 to 7/1/&yr" dmig00&yr._avg="Avg Annual Domestic Mig 7/1/00 to 7/1/&yr" TrendChange='Domestic Change Latest Yr - Previous Year'; keep state county dmig00&yrm1.: dmig&yrm1&yr dmig&yrm2&yrm1 TrendChange dmig00&yr._: ; format dmig: comma10. TrendChange comma7.; format state $state. county $mocnty.; run; proc rank data=dmigtrends descending out=popests.dmig_report_mocos(label='Report dataset for domestic migration report, MO counties'); var dmig0004_avg dmig0304 dmig0405 TrendChange dmig0005_avg dmig0004_tot dmig0005_tot; ranks Rankdmig0004_avg Rankdmig0304 Rankdmig0405 RankTrendChange Rankdmig0005_avg Rankdmig0004_tot Rankdmig0005_tot; run; options ls=120 ps=60; title 'Domestic Migration Trends for Missouri Counties, 2003-2005'; title2 'Yearly and Average Yearly Changes'; proc print data=dmigtrends; var dmig0004_avg dmig0304 dmig0405 TrendChange dmig0005_avg dmig0004_tot dmig0005_tot; id county; run; proc print data=popests.dmig_report_mocos; title2 'Ranks Based on Yearly and Average Yearly Changes'; id county; var Rankdmig0004_avg Rankdmig0304 Rankdmig0405 RankTrendChange Rankdmig0005_avg Rankdmig0004_tot Rankdmig0005_tot; run; ods html file="/pub/data/popests/Reports/&pgm..html" (title="Domestic Migration by Missouri Counties") ; *** ods printer pdf file="&ptlib2&slash&tname._&rtype_edit.®code..pdf" title="&rtitle" keywords="&keywords ®word" style=sasweb2; options pageno=1 ; title 'Domestic Migration Trends for Missouri Counties'; title2 'Annual and Average Annual Domestic Migration Figures, 2000-2005'; proc report data=popests.&pgm nofs headskip headline style(column)=[foreground=black background=white font_face=helvetica font_size=2] style(lines)=[foreground=black background=lightgrey font_face=arial font_weight=bold font_size=2]; by state; *---Adding the or condition 2-7-06 so that report contains a state summary line---; **where ®type="®code" or sumlev="040"; column County ('Annual Net Domestic Migration' dmig0304 dmig0405 TrendChange) ('Avg Annual Net/ Domestic Migration' dmig0004_avg dmig0005_avg) ('Total Domestic Migration' dmig0004_tot dmig0005_tot); define County/ 'County' display format=$mocnty16.; define dmig0304 /'2003-2004' display format=comma9.; define dmig0405 / '2004-2005' display format=comma9.; define TrendChange / width=12 'Change'; define dmig0004_avg / '2000-2004' display format=comma9.; define dmig0005_avg / '2000-2005' display format=comma9.; define dmig0004_tot /'2000-2004' display format=comma12.; define dmig0005_tot /'2000-2005' display format=comma12.; run; *-------------Repeat report for ranks--------------------------------------; title3 'Part 2: Rankings'; proc report data=popests.&pgm nofs headskip headline style(column)=[foreground=black background=white font_face=helvetica font_size=2] style(lines)=[foreground=black background=lightgrey font_face=arial font_weight=bold font_size=2]; *---Adding the or condition 2-7-06 so that report contains a state summary line---; **where ®type="®code" or sumlev="040"; column County ('Annual Net Domestic Migration' rankdmig0304 rankdmig0405 rankTrendChange) ('Avg Annual Net/ Domestic Migration' rankdmig0004_avg rankdmig0005_avg) ('Total Domestic Migration' rankdmig0004_tot rankdmig0005_tot); define County / 'County' display format=$mocnty15.; define rankdmig0304 /'2003-2004' display format=3.; define rankdmig0405 / '2004-2005' display format=3.; define rankTrendChange / width=12 'Change'; define rankdmig0004_avg / '2000-2004' display format=3.; define rankdmig0005_avg / '2000-2005' display format=3.; define rankdmig0004_tot /'2000-2004' display format=3.; define rankdmig0005_tot /'2000-2005' display format=3.; compute after / style=[font_face=arial font_size=1 foreground=gray]; line ' '; line "Source: U.S. Bureau of the Census, Federal State Coop for Population Estimates. State and county level estimates"; line " with components of change, 2000 to 2005. Released March, 2006"; line 'Prepared by the University of Missouri Extension, Office of Social & Economic Data Analysis (OSEDA)'; line "Report generated on &sysdate9 by setup in &pgm"; endcomp; run; ods html close; *** ods printer close;