Hi,
I'm trying to attach an excel file to an automated email through SAS. I can get it to work as HTLM but not as an attachment. Code attached.
Any help appreciated
FILENAME outmail EMAIL
To= "AAAAA@services.com.au"
From= "bbbbbbbb@services.com.au"
Subject= "updates"
Attach=("/sasdata/ccc/dev/bbbbb/cccccc/BIS/Data/SASLib/0.d/CAR/misc/SSW_Data/Test.xlsx" content_type= "application/xlsx"); /*this is the filepath you want*/;
RUN;
Data report.Smart_Tools_Weekly;
Set Cartel.preagent_telephony;
Keep FINANCIAL_YEAR_NM WEEK_END_DT EVENT_DT CLUSTER
CALLS_ANSWERED_CNT CALLS_ABANDONED_CNT TOTAL_ANSWER_TM;
Where event_dt >= '30Jun2014.'d
and PROGRAMME_NM = 'SSW'
and CLuster_ID in (1,6,9,13,18,27)
and QUEUE_TYPE in ('chops'
'PST')
and CALL_TYPE = 'External';
run;
Proc Sort Data=Report.Smart_Tools_Weekly;
By FINANCIAL_YEAR_NM WEEK_END_DT EVENT_DT CLUSTER;
run;
Proc Summary Data=report.Smart_Tools_Weekly SUM;
By FINANCIAL_YEAR_NM WEEK_END_DT EVENT_DT CLUSTER;
VAR CALLS_ANSWERED_CNT CALLS_ABANDONED_CNT TOTAL_ANSWER_TM;
output out=Report.Smart_Tools_Weekly_SUM (DROP=_FREQ_ _TYPE_) SUM=;
Run;
Data report.Smart_Tools_Weekly_AHT;
Set CARTEL.Employee_Telephony;
Keep FINANCIAL_YEAR_NM WEEK_END_DT EVENT_DT CLUSTER TOTAL_CALLS Total_Handle_Time;
Where event_dt >= '30Jun2014.'d
and PROGRAMME_NM = 'SSW'
and CLuster_ID in (1,6,9,13,18,27)
and QUEUE_TYPE in ('chops'
'PST')
and CALL_TYPE = 'External';
Total_Handle_Time = TALK_TIME + WORK_TIME + HOLD_TIME + EXTENDED_WORK_TIME;
run;
Proc Sort data=report.Smart_tools_weekly_aht;
By FINANCIAL_YEAR_NM WEEK_END_DT EVENT_DT CLUSTER;
RUN;
Proc Summary Data=report.Smart_tools_weekly_aht SUM NOPRINT;
BY FINANCIAL_YEAR_NM WEEK_END_DT EVENT_DT CLUSTER;
VAR TOTAL_CALLS Total_Handle_Time;
Output out=report.Smart_tools_weekly_aht_SUM (DROP=_TYPE_ _FREQ_) SUM=;
RUN;
Data Report.Smart_Tools_Weekly_Merge;
Merge Report.Smart_Tools_Weekly_SUM Report.Smart_tools_weekly_aht_SUM;
By FINANCIAL_YEAR_NM WEEK_END_DT EVENT_DT CLUSTER;
Run;
ODS HTML file="/sasdata/ccc/dev/bbbbb/cccccc/BIS/Data/SASLib/0.d/CAR/misc/SSW_Data/Test.xlsx";
Proc Print Data=REPORT.Smart_Tools_Weekly_Merge NOOBS;
Run;
ODS HTML close;
Proc SQL;
Drop table report.Smart_Tools_Weekly;
Drop table report.Smart_Tools_Weekly_SUM;
Drop table report.Smart_Tools_Weekly_AHT;
Drop table report.Smart_Tools_Weekly_AHT_SUM;
Quit;
Cheers
Hi @DME790;
Try using this code,
for me it is working fine;
options emailsys=SMTP emailhost=YOUR_SMTP_HOSTNAME emailport=25;
filename mymail email subject="test
message" ATTACH='C:\Location\excelfile.xlsx';
data _null_;
file mymail to='reciever.com@addres.com' from='sender@addres.com';
put "Hi User";
put "This is sample content";
run;
This is the link which describes about send email from Base SAS:
http://www2.sas.com/proceedings/forum2008/038-2008.pdf
Regards,
Kalind
Hi @DME790;
Try using this code,
for me it is working fine;
options emailsys=SMTP emailhost=YOUR_SMTP_HOSTNAME emailport=25;
filename mymail email subject="test
message" ATTACH='C:\Location\excelfile.xlsx';
data _null_;
file mymail to='reciever.com@addres.com' from='sender@addres.com';
put "Hi User";
put "This is sample content";
run;
This is the link which describes about send email from Base SAS:
http://www2.sas.com/proceedings/forum2008/038-2008.pdf
Regards,
Kalind
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
Check out this tutorial series to learn how to build your own steps in SAS Studio.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.