Hi Guys,
I have data of our sales team in sas data set.
emp_code | name | dept | li_revenue | mf_revenue | gi_revenue | Total_Revenue | email_id |
1 | a | SALES | 5000 | 0 | 200 | 5200 | ABC@MAIL.COM |
2 | b | SALES | 1000 | 0 | 3000 | 4000 | BC@MAIL.COM |
3 | c | SALES | 2000 | 2500 | 4000 | 8500 | AS@MAIL.COM |
4 | b | SALES | 3000 | 3600 | 5000 | 11600 | GB@MAIL.COM |
5 | e | SALES | 400 | 500 | 6000 | 6900 | DB@MAIL.COM |
Want to create Detail report and want same is email as Attachment or Mail Body .
emp code 1
Subject :- Issued Revenue
Dear a,
Revenue done in the month of Jun15.
Li Revenue --5000/-
MF Revenue -- 0/
Gi Rebvenue -- 200/
Total Revenue -- 5200/-
Regard
XYZ Bank
Corporate Office
You'll probably need to do this in a data step.
There are lot of examples you learn from at support.sas.com.
Post it at ODS and REPORT forum , Cynthia has done it before .
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
Don’t miss the livestream kicking off May 7. It’s free. It’s easy. And it’s the best seat in the house.
Join us virtually with our complimentary SAS Innovate Digital Pass. Watch live or on-demand in multiple languages, with translations available to help you get the most out of every session.
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.
Ready to level-up your skills? Choose your own adventure.