Is it possible to send PROC GMAP output directly in the body of an Outlook email? I have done this with other charts/tables and don't see a reason why GMAP would not work, however when I run the code below, it just outputs a table of data from my table, not an actual map. I'm guessing this might be due to GMAP HTML output needing a .png file as well for SAS 9.2. Any insight is greatly appreciated! Thanks!
/* Send Email */
option emailhost='localhost';
filename mymail email
from="me@me.com"
to=("you@you.com")
subject="GMAP Output"
content_type="text/html" ;
ods MSOffice2K
body=mymail style=BarrettsBlue;
proc gmap
map=mymap
data=mydata;
id state;
choro Group / levels=10 legend=legend1 coutline=black html=my_html;
run;
quit;
ods msoffice2k close;
goptions reset=all;
/* Send Email */
Hi: ODS MSOFFICE2K is an HTML based destination. This means that internally to the HTML, any image -- any logo, picture, graph is referenced with an <IMG> tag in the HTML. So when SAS creates output, in the absence of any instructions from you, the PNG image is created in the working directory of your SAS session. When ever you create an HTML file, whether with ODS HTML or ODS MSOFFICE2K, you need to send the HTML file itself and then any external files, like CSS or PNG files that the HTML files is referencing. This is an argument AGAINST using ODS HTML or ODS MSOFFICE2K for email. In fact, many email administrators do not want you to send HTML files in the body of the mail or even as attachments. Or, sometimes they block mail that contains HTML tags.
It might be better for you to make an RTF or PDF file with ODS (in which the image will be embedded INSIDE the document and will not be a separate image), and then send the RTF or PDF file as an attachment.
cynthia
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.