I am trying to write a script where I import a excel file with name, brand and EMAIL. Once I imported the file I used the following
proc sql noprint;
select EMAIL into :HAT_emails2 separated by '" "'
from work.EMAILS
where
brand ='HAT';
quit;
proc sql noprint;
select name into :HAT_names separated by ''
from work.EMAILS
where
brand ='HAT';
quit;
and then continued to do the following :
FILENAME Mailbox EMAIL
to= ("&HAT_emails2.")
Subject="testing this email"
from='raymondb_test@test.co.za'
sender='raymondb_test@test.co.za'
replyto='raymondb_test@test.co.za'
%let email_date = %sysfunc(today(),YYMMDD10.);
%put &email_date.;
DATA _NULL_;
FILE Mailbox;
PUT "Hi &HAT_names2.";
run;
The problem is that the "&HAT_names2." only works for the first name on the list how do i get it to send a personalized email for each name in the list?
The email is sent to each email address in the import however when trying to personalize the email with each persons name in the next column (name) this only shows the first record for all the emails sent. The PUT "Hi &HAT_names2."; only shows the first name in the dataset to all the emails sent.
See the example from my How to Send Email with SAS article. There are examples of sending one email to a list of recipients, as well as personalized emails where the content is different per recipient.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.