%let name=us_dry_counties; filename odsout '.'; /* Set your current-working-directory (to read/write files), if you need to ... %let rc=%sysfunc(dlgcdir('c:\someplace\public_html')); */ filename odsout '.'; /* Similar to this map: https://en.wikipedia.org/wiki/List_of_dry_communities_by_U.S._state#South_Carolina */ proc format; value statfmt 1 = "Wet" 2 = "Mixed" 3 = "Dry" ; run; data my_data; set mapsgfk.us_counties_attr (rename=(idname=county_name)); status=.; if statecode='CA' then status=1; if statecode='OR' then status=1; if statecode='WA' then status=1; if statecode='ID' then status=1; if statecode='MT' then status=1; if statecode='NV' then status=1; if statecode='NV' and county in (17) then status=2; if statecode='UT' then status=1; if statecode='AZ' then status=1; if statecode='HI' then status=1; if statecode='AK' then status=1; if statecode='AK' and county in (185 188) then status=2; if statecode='WY' then status=1; if statecode='CO' then status=1; if statecode='NM' then status=1; if statecode='NM' and county in (41 9) then status=2; if statecode='ND' then status=1; if statecode='SD' then status=1; if statecode='SD' and county in (113) then status=3; if statecode='NE' then status=1; if statecode='TX' then status=2; if statecode='TX' and county in (141 229 109 377 43 427 215 61 261 273 355 127 479 505 507 271 465 421 357 47 247 131 283 435 135 329 335 353 415 151 87 75 101 469 175 7 481 157 89 15 477 41 149 177 55 187 91 29 259 53 411 129 487 77) then status=1; if statecode='TX' and county in (393 211 263 33 317 447) then status=3; if statecode='MN' then status=1; if statecode='IA' then status=1; if statecode='WI' then status=1; if statecode='ME' then status=1; if statecode='WV' then status=1; if statecode='SC' then status=1; if statecode='OK' then status=1; if statecode='OK' and county in (25 7 59 3 57 129 43 149 15 33 1 61 63 29) then status=3; if statecode='KS' then status=2; if statecode='KS' and county in (187 199 81 69 119 89) then status=3; if statecode='KS' and county in (129 189 67 71 203 171 101 109 33 7 21 125 35 37 207 65 147 51 173 57 47 185 9 159 169 161 61 111 103 209 45 177 13) then status=1; if statecode='MO' then status=1; if statecode='IL' then status=1; if statecode='IL' and county in (31) then status=2; if statecode='IN' then status=1; if statecode='MI' then status=2; if statecode='MI' and county in (53 131 71 43 109 13 83 3 41 153 95 33 141 119 137 39 55 69 17 99 163 121) then status=1; if statecode='NC' then status=2; if statecode='NC' and county in (75) then status=3; if statecode='NC' and county in (183 101 63 135 37 119 129 141 133 95 131 83 185 77 33 137 43 93 51) then status=1; if statecode='FL' then status=1; if statecode='FL' and county in (67) then status=2; if statecode='FL' and county in (77 133) then status=3; if statecode='GA' then status=1; if statecode='GA' and county in (87 27 103 31 177 293 35 169 77 213 291 187 311 147) then status=2; if statecode='VA' then status=1; if statecode='VA' and county in (105 91 45 21 27 167 77 141 63 37) then status=2; if statecode='MD' then status=1; if statecode='PA' then status=2; if statecode='PA' and county in (83 47 23 103 89 25 107 11 91 101 77 95) then status=1; if statecode='OH' then status=2; if statecode='OH' and county in (61 17 149 39 51 95 123 143 43 77 35 103 153 85 49) then status=1; if statecode='AL' then status=1; if statecode='AL' and county in (61 31 71 49 19 59 93 75 77 107 7 57 127 133 43 103 83 79 9 95 27 129 25 99) then status=2; if statecode='LA' then status=1; if statecode='LA' and county in (11 3 69 79 85 31 123 67 111 119 13 61 43 127 9 49 21 83 41) then status=2; if statecode='AR' then status=3; if statecode='AR' and county in (91 7 87 9 89 5 135 19 17 41 107 77 17) then status=1; if statecode='AR' and county in (139 103 13 39 25 43 69 1 95 123 37 111 35 93 55 67 147 51 143 15 131 47 83 29 119) then status=2; if statecode='TN' then status=2; if statecode='TN' and county in (157 5 37 93 65) then status=1; if statecode='TN' and county in (109 131 183 33 181 39 11 139 121 143 49 129 25 173 57 89 91 161 125 83) then status=3; if statecode='MS' then status=1; if statecode='MS' and county in (3 109 73 67 61 99 121 49 17 95 145 137) then status=2; if statecode='MS' and county in (117 57 39 41 153 23 131 101 123 79 7 19 155 13 115 139 9 37 85 77 147 127 129 31) then status=3; if statecode='DE' then status=1; if statecode='NJ' then status=2; if statecode='NJ' and county in (37 41 19 27 9 23 39 13 31) then status=1; if statecode='NY' then status=1; if statecode='NY' and county in (13 3 101 75 23 25 105) then status=2; if statecode='CT' then status=1; if statecode='RI' then status=1; if statecode='MA' then status=1; if statecode='MA' and county in (3 11 15 13 17 7) then status=2; if statecode='VT' then status=1; if statecode='NH' then status=1; if statecode='NH' and county in (9 3 11) then status=2; if statecode='KY' then status=3; if statecode='KY' and county in (195 95 13 235 231 199 125 51 35 157 139 83 219 141 33 107 177 213 227 9 89 43 135 205 115 191 81 187 209 223 103 211 93 185 41 77 87 217 229 21 79 113 151) then status=2; if statecode='KY' and county in (75 145 221 143 59 101 225 47 71 153 237 193 161 23 97 181 17 67 49 15 117 37 29 111 27 163 179 215 73 5 239 155 189) then status=1; run; data my_data; set my_data; length my_html $300; my_html= 'title='||quote( propcase(trim(left(county_name)))||' county, '||trim(left(statecode))||'0d'x|| trim(left(put(status,statfmt.))))|| ' href='|| quote('https://en.wikipedia.org/wiki/List_of_dry_communities_by_U.S._state#'|| translate(trim(left(id1name)),'_',' ')); run; libname robsmaps '../democd97'; data my_map; set robsmaps.uscounty (where=(density<=1)); run; proc gremove data=my_map out=anno_outline; by state; id county; run; data anno_outline; set anno_outline; by state segment notsorted; length function $8 color $8; color='gray88'; style='mempty'; when='a'; xsys='2'; ysys='2'; if first.segment then function='poly'; else function='polycont'; run; goptions device=png; goptions xpixels=1000 ypixels=720; goptions noborder; ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" (title="Wet or Dry counties") style=htmlblue; goptions gunit=pct htitle=5.5 ftitle="albany amt/bold" htext=1.9 ftext="albany amt/bold"; legend1 across=1 label=none shape=bar(.15in,.15in) mode=share position=(bottom right) offset=(-6,18) value=(justify=left) order=descending; title1 ls=1.5 "'Dry' (Alcohol) Counties in the US"; pattern1 v=s c=white; pattern2 v=s c=cxFFE600; pattern3 v=s c=cxff0000; data my_data; set my_data; status2=status; if status2=1 then status2=.; run; proc gmap data=my_data map=my_map all anno=anno_outline; format status2 statfmt.; note move=(20.5,88) link='https://en.wikipedia.org/wiki/List_of_dry_communities_by_U.S._state' c=gray ls=1.0 "Data source: en.wikipedia.org/wiki/List_of_dry_communities_by_U.S._state (May 2019)"; id state county; choro status2 / midpoints=1 2 3 legend=legend1 coutline=graybb cdefault=white cempty=grayee /* tricky way of de-emphasizing wet counties */ html=my_html des='' name="&name"; run; /* color scheme similar to the original Wikipedia map */ /* data anno_outline; set anno_outline; color='white'; run; pattern1 v=s c=cx006bb1; pattern2 v=s c=cxfbd515; pattern3 v=s c=cxcc0000; ods html anchor='orig'; proc gmap data=my_data map=my_map all anno=anno_outline; format status statfmt.; note move=(20.5,88) link='https://en.wikipedia.org/wiki/List_of_dry_communities_by_U.S._state' c=gray ls=1.0 "Data source: en.wikipedia.org/wiki/List_of_dry_communities_by_U.S._state (May 2019)"; id state county; choro status / midpoints=1 2 3 legend=legend1 coutline=grayaa html=my_html des='' name="&name._orig"; run; */ quit; ODS HTML CLOSE; ODS LISTING;