Desktop productivity for business analysts and programmers

Emailing Excel attachment SAS EG9.1

Accepted Solution Solved
Reply
Contributor
Posts: 48
Accepted Solution

Emailing Excel attachment SAS EG9.1

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

 


Accepted Solutions
Solution
‎11-24-2016 04:33 PM
Frequent Contributor
Posts: 96

Re: Emailing Excel attachment SAS EG9.1

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


All Replies
Solution
‎11-24-2016 04:33 PM
Frequent Contributor
Posts: 96

Re: Emailing Excel attachment SAS EG9.1

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

Contributor
Posts: 48

Re: Emailing Excel attachment SAS EG9.1

Thanks Kalind - works a treat
☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

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