Hi I have this code for an email which includes two sgplots and a proc report table:
ods html close;
ods listing;
filename sendmail email bcc=("test@ki") FROM=("test@ki")
subject="test &todaysDate."
CT="text/html"
attach=("\\test_&todaysDate..pdf" ct ='pdf')
attach=("\\test_&todaysDate..pdf" ct ='pdf');
ods html body=sendmail rs=none style=deliveries;
ods noproctitle;
ods noptitle;
title;
ods html text = '<img src="Figur1_&todaysDate..png""></img>';
proc report data=metode_count missing style(column)= [background = white fontsize=2 font_weight = bold] style(header) = {background = white frame=void} ;
columns new1 metode,COUNT ;
define new1 /'' group style(column)= [background = white fontsize=2 font_weight = bold] style(header) = {background = white frame=void};
define metode/'' across style(column)= [background = white fontsize=2] style(header) = {background = white frame=void} ;
define count/'' analysis sum style(column)= [background = white fontsize=2] style(header) = {background = white frame=void} ;;
run;
ods html text = '<img src="Figur2_&todaysDate..png""></img>';
ods html close;
ods listing;
But the images wont appear in the email,what am i doing worong here
You only have the image links in the mail body, but the images themselves are nowhere.
If you want the images to be visible in the mail, use the INLINED option within the ATTACH= option of the FILENAME EMAIL statement.
ods html close;
ods listing;
filename sendmail email bcc=("test@ki") FROM=("test@ki")
subject="test &todaysDate."
CT="text/html"
attach=("\\test_&todaysDate..pdf" ct ='pdf')
attach=("\\test_&todaysDate..pdf" ct ='pdf');
attach=("\\Figure1_&todaysDate..png" ct ='png')
attach=("\\Figure2_&todaysDate..png" ct ='png');
ods html body=sendmail rs=none style=deliveries;
ods noproctitle;
ods noptitle;
title;
ods html text = '<img src="Figur1_&todaysDate..png""></img>';
proc report data=metode_count missing style(column)= [background = white fontsize=2 font_weight = bold] style(header) = {background = white frame=void} ;
columns new1 metode,COUNT ;
define new1 /'' group style(column)= [background = white fontsize=2 font_weight = bold] style(header) = {background = white frame=void};
define metode/'' across style(column)= [background = white fontsize=2] style(header) = {background = white frame=void} ;
define count/'' analysis sum style(column)= [background = white fontsize=2] style(header) = {background = white frame=void} ;;
run;
ods html text = '<img src="Figur2_&todaysDate..png""></img>';
ods html close;
ods listing;
A PDF file is NOT of type PNG.
And you did NOT use the INLINED option. Please read the documentation I linked to (see Example 6).
My bad.. it was i typo, in my code.
Its still dosent work after I run the corrected code.
I will try with the inlined
i tried this:
I worked for miy PNG but not he PDF - how can I show the PDF in the body of my email:
options emailsys=smtp;
filename myemail email
to="test@sdfi.dk"
from="dsf@df.dk"
attach=("F:Figur2_&todaysDate..png" INLINED="logo1")
attach=("F:test.pdf" INLINED="logo2")
subject="D."
content_type="text/html";
data _null_;
file myemail;
put '<IMG src="cid:logo1" >';
put '<IMG src="cid:logo2">';
run;
AFAIK, you can't make PDFs visible like a picture. I suggest you use ODS HTML to write your report to the email file reference to make it show in the mail body.
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.