x cd /pub/data/workflow/Tools; %let pgm=cnvtus; filename pgm "&pgm..sas"; *---Read the county-to-county worker flow files from the 2000 census. Using data as posted to embargoed directory 3-3-03. ----*; title "workflow: &pgm : Convert 2000 census work flow file"; filename res_in '../2KRESCO_US.TXT'; *filename wrk_in '../2KWRKCO_US.TXT'; *--decided no need to read this file. All we have to do is sort the data we read from the res_in file.--; libname workflow '/pub/data/workflow'; /*<=========================Comment out===================================== *----Conversion step---; data workflow.usbyres (label='US work flows sorted by Residence side' ); infile res_in; length StateR $2 CountyR $5 msacmsaR pmsaR $4 AreanameR $40; length StateW $2 CountyW $5 msacmsaW pmsaW $4 AreanameW $40; length CountryW $3; length Count 8; label stater='State of Residence' countyr='County of Residence' msacmsaR='MSA or CMSA of Residence' AreanameR='Work Flows From (Residence)'; label statew='State of Work' countyw='County of Work ' msacmsaw='MSA or CMSA of Work' AreanameW='Work Flows Into...'; label countryW='Country of Work'; length Count 5; label count='Work Flows'; input stater $2. +1 cntyr $3. +1 msacmsar $4. +1 pmsar $4. @18 Areanamer $40. @59 _col59 $1. statew $2. +1 cntyw $3. +1 msacmsaw $4. +1 pmsaw $4. @77 Areanamew $40. Count 118-124; CountyR=stater||cntyr; if _col59 gt '0' then do; statew='99'; *<---pseudocode to indicate outside US--; countyw=' '; countryW=_col59||statew; end; else countyw=statew||cntyw; drop cntyr cntyw _col59; run; *---this sort leaves it sorted by residence county but then within that orders the data according to the # work flows--; proc sort data=workflow.usbyres(index=(stater)) force; by stater countyr descending count; run; *---define some indices for faster access---; proc datasets library=workflow; modify usbyres; *index delete statew; index create statew; *index delete countyr; index create countyr; *index delete countyw; index create countyw; quit; proc sql; create view workflow.usbywrk as select * from usbyres order by statew, countyw, count desc; quit; ===========================End commented out================================ */ *----Generate reports showing significant flow (50+) for Missouri counties. One report is sorted by residence geography, the other by work. -----; ods listing close; options nodate pageno=1; ods pdf file='../mocos50plus.Rsort.pdf'; title "Counts of Workers Commuting To and From Missouri Counties"; title2 'Minimum of 50 Trips'; proc print data=workflow.usbyres noobs label; by stater areanamer notsorted msacmsar ; format stater $fipstab.; where (stater='29' | statew='29') and count ge 50; format msacmsar msacmsaw $metro28.; id stater AreanameR msacmsar; var areanameW msacmsaw count; format count comma9.; title3 'Sorted by Residence Geography'; footnote 'Note: Change "Rsort" to "Wsort" in URL to Get Comparable Report Sorted by Work Geography'; run; ods pdf close; options pageno=1; ods pdf file='../mocos50plus.Wsort.pdf'; title "Counts of Workers Commuting To and From Missouri Counties"; title2 'Minimum of 50 or More Trips'; proc sort data=workflow.usbyres out=Wsort; by statew countyw descending count; where (stater='29' | statew='29') and count ge 50; run; proc print data=Wsort noobs label; by statew areanamew notsorted msacmsaw ; format statew $fipstab.; format msacmsar msacmsaw $metro28.; id statew Areanamew msacmsaw; var areanamer msacmsar count; format count comma9.; title3 'Sorted by Work Geography'; footnote 'Note: Change "Wsort" to "Rsort" in URL to Get Comparable Report Sorted by Residence Geography'; run; ods pdf close;