Hi,
I wish to send email to multiple people from the dataset.
Dataset contains Name and email address. I should send each of them with Hi Name, with message body.
In actual data around 100 email is present and sample data sharing below
I have tried below method but getting an error
data Employee;
input Name $ Email :$30.;
datalines;
John John@xyz.com
david david@xyz.com
Joe joe@xyz.com
;
%macro sendreports(name,email);
filename outbox email;
data _null_;
file outbox
to= ("&email")
subject="Test subject"
file outbox;
put "Dear &name.,";
put "Thank you";
run;
%mend Sendreports;
data _null_;
Set Employee;
call execute(cats('%sendreports(',email,',',name,')'));
run;
Please guide me to do it.
What's the error message?
When I'm sending multiple emails, I usually do it like this:
data Employee;
input Name $ Email :$60.;
datalines;
John John@xyz.com
David david@xyz.com
Joe joe@xyz.com
;
run;
proc print;
run;
filename ELIST EMAIL
ENCODING = "UTF-8"
CONTENT_TYPE = 'text/html'
lrecl = 32767
;
data _NULL_;
file ELIST;
set Employee;
/* new message tag */
put '!EM_NEWMSG!';
/* Title */
put '!em_subject! ' "This is the subject.";
/* Recipient */
put '!em_to! ' email;
/* Sender */
put '!em_from! ' "FromWhom@email.com";
put '!em_replyto! ' "replyTo@email.com";
/* Content */
put '<p> Dear ' Name '! </p>';
put '<p> Have a great day! </p>';
put '<p> Yours truly </br> Sastech </p>';
/* send mail tag */
put '!EM_SEND!';
put '!EM_NEWMSG!';
put '!EM_ABORT!';
run;
Bart
Is your local email server complaining about you sending multiple emails, in effect creating SPAM?
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.
Ready to level-up your skills? Choose your own adventure.