BookmarkSubscribeRSS Feed
shlomiohana
Obsidian | Level 7

Hello,


I have the following final table (every day the table contents change):

DateBank_IDBranch_IDAccount_NumberCredit_Card_GroupMail_To
01/10/20202011234567pixpix@gmail.com
01/10/2020201123224334pixpix@gmail.com
01/10/202020221268699lumlum@gmail.com
01/10/202020342344523lumlum@gmail.com
01/10/202020141234598pixpix@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.

1 REPLY 1
ChrisNZ
Tourmaline | Level 20

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

 

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 791 views
  • 0 likes
  • 2 in conversation