/* trying to make a better version of: http://awesome.good.is/transparency/web/1009/sprawl-crawl/flat.html using data from: http://www.ceosforcities.org/research/driven-apart (link along right-hand side, then go to p. 48) */ data traffic (drop=whole_line numbers); infile datalines pad truncover; input whole_line $ 1-100; length city_state $50; city_state=trim(left(scan(whole_line,1,':'))); length City $45; city=trim(left(scan(city_state,1,','))); length state $3; state=trim(left(scan(city_state,2,','))); length numbers $100; numbers=scan(whole_line,2,':'); format population peak_travelers comma10.0; population=input(scan(numbers,1,' '),comma10.0); peak_travelers=input(scan(numbers,2,' '),comma10.0); travel_time_index=.; travel_time_index=scan(numbers,3,' '); hours_of_delay=.; hours_of_delay=scan(numbers,4,' '); total_hours=.; total_hours=scan(numbers,5,' '); uncongested_travel=.; uncongested_travel=scan(numbers,6,' '); miles=.; miles=scan(numbers,7,' '); intrix_tti=.; intrix_tti=scan(numbers,8,' '); format percent_congested percent7.1; percent_congested=hours_of_delay/total_hours; datalines; Boston, MA : 4,200 2,113 1.26 43 208 165 19.8 1.18 Hartford, CT : 895 489 1.12 21 196 175 19.9 1.10 New York, NY : 18,225 8,602 1.37 44 163 119 18.9 1.45 Philadelphia, PA : 5,310 2,947 1.28 38 174 136 17.4 1.14 Washington, DC : 4,330 2,174 1.39 62 221 159 21.5 1.28 Virginia Beach, VA : 1,545 865 1.18 29 190 161 18.0 1.15 Richmond, VA : 935 514 1.09 20 242 222 22.5 1.03 Raleigh, NC : 1,025 574 1.17 34 234 200 22.2 1.06 Charlotte, NC : 1,070 599 1.25 40 200 160 19.1 1.13 Pittsburgh, PA : 1,815 1,016 1.09 15 182 167 15.8 1.10 Cleveland, OH : 1,790 995 1.08 12 162 150 16.3 1.06 Columbus, OH : 1,225 686 1.18 30 197 167 19.9 1.05 Cincinnati, OH: 1,670 949 1.18 25 164 139 17.7 1.07 Indianapolis, IN : 1,070 599 1.21 39 225 186 22.6 1.05 Louisville, KY : 915 503 1.20 38 228 190 21.7 1.05 Atlanta, GA : 4,400 2,371 1.35 57 220 163 21.6 1.18 Birmingham, AL: 715 393 1.15 32 245 213 23.3 1.04 Buffalo, NY : 1,125 540 1.07 11 168 157 16.6 1.04 Dallas, TX : 4,445 2,645 1.32 53 219 166 20.9 1.15 Denver, CO : 2,180 1,358 1.31 45 190 145 17.0 1.11 Detroit, MI : 4,050 2,268 1.29 52 231 179 20.9 1.15 Houston, TX : 3,185 2,232 1.33 56 226 170 22.1 1.18 Jacksonville, FL : 1,040 582 1.23 39 209 170 20.5 1.10 Kansas City, KS : 1,525 854 1.07 15 229 214 21.6 1.06 Las Vegas, NV : 1,405 787 1.30 44 191 147 17.6 1.07 Los Angeles, CA : 12,800 6,976 1.49 70 213 143 21.1 1.29 Memphis, TN : 1,035 580 1.12 25 233 208 20.7 1.06 Miami, FL : 5,420 3,095 1.37 47 174 127 16.5 1.21 Milwaukee, WI : 1,465 804 1.13 18 156 138 17.2 1.08 Chicago, IL : 8,440 4,566 1.43 41 136 95 13.5 1.23 Minneapolis, MN : 2,525 1,414 1.24 39 202 163 20.1 Nashville, TN : 995 547 1.15 37 284 247 25.2 1.17 New Orleans, LA : 1,100 579 1.17 20 138 118 12.6 1.10 Oklahoma City, OK: 875 481 1.12 27 252 225 24.1 1.05 Orlando, FL : 1,405 787 1.30 53 230 177 20.9 1.08 Phoenix, AZ : 3,425 1,829 1.30 44 191 147 19.4 1.12 Portland, OR : 1,800 931 1.29 37 165 128 16.0 1.20 Sacramento, CA : 1,860 1,001 1.32 39 161 122 16.2 1.10 Salt Lake City, UT : 975 536 1.19 27 169 142 16.0 1.05 San Antonio, TX : 1,450 812 1.23 38 203 165 20.2 1.09 San Diego, CA : 2,950 1,652 1.37 52 193 141 19.8 1.24 San Francisco, CA : 4,480 2,339 1.42 55 186 131 19.5 1.31 Seattle, WA : 3,100 1,696 1.29 43 191 148 18.8 1.29 Saint Louis, MO : 2,215 1,240 1.13 26 226 200 20.7 1.08 Tampa, FL : 2,320 1,299 1.31 47 199 152 17.8 1.12 ; run; proc sort data=traffic; by descending total_hours; run; proc means data=traffic min mean median max; var total_hours hours_of_delay; run; ods graphics / height=9in width=5in noscale; /* make a tall graph */ title "Mean Commute Time for Major US Cities"; footnote "Data Source: 2010 CEOsForCities.org"; proc sgplot data=traffic; hbar City / response=total_hours CategoryOrder=RespAsc transparency=0.2 name="total" legendlabel="Total"; hbar City / response=hours_of_delay name="delay" legendlabel="Due to Congestion"; keylegend "delay" "total"; xaxis grid label="Cumulative Commute Time (hours per year)"; yaxis ValueAttrs=(size=8) offsetmax=0.05; /* make room for labels */ refline 39 199 / axis=x label=("Median Delay" "Median Commute") lineattrs=(color=black) labelloc=inside; run; ods graphics / reset; /* reset graphs to default size */ title "Commute Time versus Time Spent in Congestion"; proc sgplot data=traffic; scatter x=total_hours y=hours_of_delay / MarkerAttrs=(size=12 symbol=CircleFilled) transparency=0.3 datalabel=City datalabelattrs=(size=8); xaxis grid label="Cumulative Commute Time (hours per year)" values=(125 to 300 by 25); yaxis grid label="Time Lost to Congestion (hours per year)"; run;