Hi Tarun, Please see below code if it works for you: filename nwfile 'C:\temp\sales.txt'; data sales; length email_id $ 25; infile nwfile ; input emp_code $ name $ dept $ li_revenue $ mf_revenue $ gi_revenue $ total_revenue $ email_id $; run; proc transpose data = sales out = newsales name=variable prefix = value; by emp_code name email_id; var li_revenue mf_revenue gi_revenue total_revenue; run; data newsales1; set newsales; call symput(trim(variable)||trim(emp_code), value1); call symput("_"||trim(emp_code), email_id); run; %put _user_; %macro MAILME( _to = ,_cc = ,_subject = ,_attach = ,_text1 = ,_text2 = ,_text3 = ,_text4 = ); options emailsys=smtp emailhost=smtp.ferring.com emailport=25; filename maily email (&_to) To = (&_to) CC = (&_cc) subject = "&_subject" %if &_attach ne NO %then %do; attach = "&_attach" %end;; data _null_; file maily; put "THIS IS AN AUTO GENERATED E-MAIL"; put "&_text1"; put "&_text2"; put "&_text3"; put "&_text4"; put " "; put "REGARDS"; put "XYZ Bank"; put "Corporate Office"; run; %mend; %macro chk; %do i = 1 %to 1; %MAILME(_to = "&&_&i." ,_cc = "&&_&i." ,_subject = Issue Revenue ,_attach = NO ,_text1 = Li Revenue -- &&li_revenue&i./- ,_text2 = MF Revenue -- &&mf_revenue&i./- ,_text3 = GI Revenue -- &&gi_revenue&i./- ,_text4 = Total Revenue -- &&total_revenue&i./- ); %end; %mend; %chk
... View more