Depending on your environment/network, yes, this is possible.
You can check out some references to system options here, as well as the links at the bottom of that page to the other system e-mail options.
In my experience, I've only had to specify EMAILSYS , EMAILHOST, and EMAILPORT.
I only have the ability to use SMTP on my environment so I can't speak to other protocalls but if I wanted to do this it would look similar to this:
data dummy;
infile datalines dlm="#";
input location & $16. count 10.;
datalines;
ABC# 5
DEF# 6
GHI# 8
JKL# 14
;
options emailsys = SMTP emailhost = smtp.domain.com emailport=25 nonotes nosource;
FILENAME outbox EMAIL;
DATA _NULL_;
FILE outbox
TO=("sender@domain.com")
FROM=("recipient@domain.com")
SUBJECT=("Subject" );
set dummy(where=(count >7));
PUT " ";
PUT location count;
PUT "Any other body you would want to say in the e-mail";
RUN;
That would be the most basic listing type output in the body of the e-mail.
Alternatively, you could create a pdf, rtf, html, etc. document, and attach that to the e-mail instead of printing the data output to the body of the e-mail. You would add a path to the file you just created on the FILE statment, e.g.,
ods pdf "path-to-file.ext";
proc print data=dummy;
where count > 7;
run;
ods pdf close;
FILENAME outbox EMAIL;
DATA _NULL_;
FILE outbox
TO=("sender@domain.com")
FROM=("recipient@domain.com")
SUBJECT=("Subject" )
ATTACH=("path-to-file.ext");
PUT "Hello.";
PUT " ";
PUT "Please see the attachment for dummy counts greater than 7.";
PUT " ";
run;
These are canned examples that I've used in my environment so YMMV, but they've worked for me.
... View more