BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
DME790
Pyrite | Level 9

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

 

1 ACCEPTED SOLUTION

Accepted Solutions
Kalind_Patel
Lapis Lazuli | Level 10

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

View solution in original post

2 REPLIES 2
Kalind_Patel
Lapis Lazuli | Level 10

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

DME790
Pyrite | Level 9
Thanks Kalind - works a treat

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 1123 views
  • 1 like
  • 2 in conversation