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

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;

 
1 ACCEPTED SOLUTION

Accepted Solutions
DarthPathos
Lapis Lazuli | Level 10

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

4 REPLIES 4
DarthPathos
Lapis Lazuli | Level 10

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!
sdixit
Obsidian | Level 7

Hi Chris,

 

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

 

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.  

DarthPathos
Lapis Lazuli | Level 10

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!

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

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