DATA Step, Macro, Functions and more

How to Email Excel file with Multiple work sheets as attachment using SAS EMAIL ?

Accepted Solution Solved
Reply
Contributor
Posts: 26
Accepted Solution

How to Email Excel file with Multiple work sheets as attachment using SAS EMAIL ?

Hi ,

 

How to Email Excel file with Multiple work sheets as attachment using SAS EMAIL ?

I have a xlsx file to attach in my email

 

Filename hmmail_1 email TO=&Email_to_Id. CC=&Email_cc_Id.

Subject="abcth.."

 

Attach="/xx/xx/xx/xx./xx..xlsx" ;

 

%Macro Send_Mthly_Email;

Data _null_;

file hmmail_1 lrecl=375;

put "Hi All," //;

put "The report is completed."/;

put "Attached report is available ." //;

put "Thanks," /;

put "&Thanks_Name.";

output;

run;

%Mend;

%Send_Mthly_Email;

 

Accepted Solutions
Solution
‎08-11-2016 03:58 PM
Super Contributor
Posts: 250

Re: How to Email Excel file with Multiple work sheets as attachment using SAS EMAIL ?

Hi -

 

I use this paper all the time for how to build a macro for emailing.  You should be able to incorporate the code from the paper into your code and have everything work.

 

Good luck!

Chris

 

Has my article or post helped? Please mark as Solution or Like the article!

View solution in original post


All Replies
Solution
‎08-11-2016 03:58 PM
Super Contributor
Posts: 250

Re: How to Email Excel file with Multiple work sheets as attachment using SAS EMAIL ?

Hi -

 

I use this paper all the time for how to build a macro for emailing.  You should be able to incorporate the code from the paper into your code and have everything work.

 

Good luck!

Chris

 

Has my article or post helped? Please mark as Solution or Like the article!
Contributor
Posts: 26

Re: How to Email Excel file with Multiple work sheets as attachment using SAS EMAIL ?

Posted in reply to DarthPathos

Hi Chris,

 

Thanks for sharing the paper. Indeed it was helpful for me. \

 

Super User
Super User
Posts: 7,942

Re: How to Email Excel file with Multiple work sheets as attachment using SAS EMAIL ?

Just two things.  Firstly your companies email system will have size limitations on the emails you send - the reason being is that email is not a report delivery system, its principally for messaging.  Secondly, depending on setup and data in the report, you could breach rules on sending data as email (at least outside the company network) is not secure.  I would advise you, if your data has anything confidential, to address where and how you deliver reports - there are far better methods to get reports out to people, the use of secure portals - sharepoint for instance - or other secure platforms.  

Super Contributor
Posts: 250

Re: How to Email Excel file with Multiple work sheets as attachment using SAS EMAIL ?

Ooh good point @RW9!  I'm totally embarassed I didn't think to mention that, considering I work in a hosptial where privacy is a huge deal :-)  

 

There are papers about encrypting data sets with WinZip and other utilities using SAS, but Sharepoint or internal share drive would be preferred.

 

Chris

Has my article or post helped? Please mark as Solution or Like the article!
☑ This topic is solved.

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

Discussion stats
  • 4 replies
  • 666 views
  • 0 likes
  • 3 in conversation