%let name=wealth_and_health_map; /* Set your current-working-directory (to read/write files), if you need to ... %let rc=%sysfunc(dlgcdir('c:\someplace\public_html')); */ filename odsout '.'; /* libname robsdata '\\sashq\root\u\realliso\public_html\democd27\'; */ libname robsdata '../democd27'; proc sql; create table my_data as select unique country as country_name, region from robsdata.gapminder_data where year>=1950; quit; run; data my_map; set mapsgfk.world (where=(density<=1 and idname^='Antarctica') drop=resolution lat long); country_name=idname; if Country_name='United States' then Country_name='USA'; if Country_name='Russian Federation' then Country_name='Russia'; if Country_name='Korea, South' then Country_name='Korea, Rep.'; if Country_name='Korea, North' then Country_name='Korea, Dem. Rep.'; if Country_name='Bolivia, Plurinational State of' then Country_name='Bolivia'; if Country_name='Democratic Republic of Congo' then Country_name='Congo, Dem. Rep.'; if Country_name='Venezuela, Bolivarian Republic of' then Country_name='Venezuela'; if Country_name='Tanzania, United Republic of' then Country_name='Tanzania'; if Country_name='Central African Republic' then Country_name='Central African Rep.'; if Country_name='North Korea' then Country_name='Korea, Dem. Rep.'; if Country_name='South Korea' then Country_name='Korea, Rep.'; if Country_name='Taiwan, Province of China' then Country_name='Taiwan'; if Country_name='Viet Nam' then Country_name='Vietnam'; if Country_name='Dominican Republic' then Country_name='Dominican Rep.'; if Country_name='Macedonia' then Country_name='Macedonia, FYR'; run; /* my_data doesn't contain all the countries, therefore I merge in all the country names. */ proc sql; create table all_names as select unique country_name from my_map; create table my_data as select unique all_names.*, my_data.region from all_names left join my_data on all_names.Country_name=my_data.Country_name; quit; run; data my_data; set my_data; if country_name='Greenland' then region='Europe & Central Asia'; if country_name='Czech Republic' then region='Europe & Central Asia'; if country_name='Slovakia' then region='Europe & Central Asia'; if country_name='Latvia' then region='Europe & Central Asia'; if country_name='Svalbard and Jan Mayen' then region='Europe & Central Asia'; if country_name='Kosovo' then region='Europe & Central Asia'; if country_name='Yemen' then region='Middle East & North Africa'; if country_name='Zaire' then region='Sub-Saharan Africa'; if country_name='Congo' then region='Sub-Saharan Africa'; if country_name='Ivory Coast' then region='Sub-Saharan Africa'; if country_name='Western Sahara' then region='Sub-Saharan Africa'; if country_name='China/India' then region='East Asia & Pacific'; if region not in ('' 'unknown') then output; run; /* colors are assigned in data-order, therefore sort by region, to get predictable color assignment. */ proc sort data=my_data out=my_data; by region; run; /* Since sgmap doesn't support background color yet, do it with an ODS style */ ods path(prepend) work.templat(update); proc template; define style my_colors; parent=styles.htmlblue; style graphbackground / color=white; class graphcolors / 'gdata1'=cxe5ff2f 'gdata2'=cxff2f2f 'gdata3'=orange 'gdata4'=cx00ff00 'gdata5'=cx2fbfe5 'gdata6'=cxD15FEE ; end; run; ODS LISTING CLOSE; ODS HTML path=odsout body="&name..htm" (title="World map, for wealth_and_health animation") style=my_colors; ods graphics / imagefmt=png imagename="&name" width=300px height=135px; /* width=280px height=124px; */ title; footnote; proc sgmap maprespdata=my_data mapdata=my_map noautolegend des=''; choromap region / mapid=country_name id=country_name lineattrs=(color=grayaa) name="&name"; run; quit; ODS HTML CLOSE; ODS LISTING;