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='[email protected]'
sender='[email protected]'
replyto='[email protected]'
%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.