Hello,
I have the following final table (every day the table contents change):
Date | Bank_ID | Branch_ID | Account_Number | Credit_Card_Group | Mail_To |
01/10/2020 | 20 | 1 | 1234567 | pix | pix@gmail.com |
01/10/2020 | 20 | 112 | 3224334 | pix | pix@gmail.com |
01/10/2020 | 20 | 22 | 1268699 | lum | lum@gmail.com |
01/10/2020 | 20 | 34 | 2344523 | lum | lum@gmail.com |
01/10/2020 | 20 | 14 | 1234598 | pix | pix@gmail.com |
I would like to send an email to each record in the table.
According to the example, I will send 5 emails.
The Email:
From: freetalk@gmail.com
To: <Mail_To>
Subject: Closing <Account_Number> - <Branch_ID>
Email content:
<Credit_Card_Group> , <Date>
Cancel any instructions in the account <Account_Number> - <Branch_ID> -<Bank_ID>
Thanks.
Example of an email from the table:
From: freetalk@gmail.com
To: pix@gmail.com
Subject: Closing 1234567 - 1
Email content:
pix, 01/10/2020
Cancel any instructions in the account 1234567 - 1 - 20
Thanks.
I would appreciate your help.
You must use the data step syntax, something like:
FILENAME mail EMAIL;
DATA _NULL_;
SET forum.Officelist END=eof ;
FILE mail;
PUT '!EM_TO!' mailaddress;
PUT '!EM_SUBJECT!' 'New price information for ' office;
PUT "These are the fares as valid on &SYSDATE";
PUT 'Selection: ' location;
DO n=1 to NOBS;
SET forum.fares POINT=n NOBS=nobs;
IF (location = 'XXX' and package = 'Special') OR
(location ne 'XXX' and package ne 'Special' and
location eq destination)
THEN PUT destination package price;
END;
PUT '!EM_SEND!' / '!EM_NEWMSG!';
IF eof THEN PUT '!EM_ABORT!';
RUN;
See example 6 in this paper: https://support.sas.com/resources/papers/proceedings/pdfs/sgf2008/038-2008.pdf
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.