Desktop productivity for business analysts and programmers

SAS Enterprise Guide Email Multiple Attachments

Reply
Occasional Contributor
Posts: 13

SAS Enterprise Guide Email Multiple Attachments

My company has recently switched to SAS Enterprise Guide, and one of my responsibilities is to email out large batches of emails with multiple attachments. I know that to attach .xlsx files you need to add the line

content_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" lrecl=32000

 to your attach= statement.

 

I have verified that each individual attachment works but when I try to send all attachments at once, only the last one attached can be opened. Every other attachment is corrupted and can't be viewed. Any help would be appreciated, thank you.

 

%macro emaildata (to_address, attachments);
 Filename output email;
 data _null_;
	file output
	to = (&to_address.)
	subject = "Subject Line"
	attach = (&attachments. content_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" lrecl=32000);

 put "text."; 

run;
%mend emaildata;


/* Test */
%emaildata ('recipient', "&attach1." "&attach2." "&attach3." "&attach4." "&attach5." "&attach6.");
Trusted Advisor
Posts: 2,127

Re: SAS Enterprise Guide Email Multiple Attachments

[ Edited ]

Cole,

 

I don't have an answer to using the macro. 

 

Sometimes EGuide works better if you use its tools.  If you have a file to send, right click on it and select 'send to' and then 'email as a step in the project'.  Once you've added one file, you can add others.  It's pretty flexible about sending data and reports.

 

{Added}.  You need to do some setup in tools--> options and the mail is sent from your pc, not from the server.

New User
Posts: 1

Re: SAS Enterprise Guide Email Multiple Attachments

* Each attachment must have a separate attach statement;

data _null_;

file outbox

to=(&email_to)

cc=(&email_cc)

From=(&email_from)

subject="Subject here"

attach=("file1.csv")

attach=("file2.csv");

put "*** My report *** ";

run;

 

Respected Advisor
Posts: 4,779

Re: SAS Enterprise Guide Email Multiple Attachments

[ Edited ]
Posted in reply to Julian_Visch

@Julian_Visch wrote:

* Each attachment must have a separate attach statement;

 

 


@Julian_Visch

You can attach multiple documents via a single ATTACH statement as documented here:

http://go.documentation.sas.com/?docsetId=hostunx&docsetTarget=p1hl3t66coao7bn18vrmhx2gte1q.htm&docs...

 

 
ATTACH='filename.ext' | ATTACH= ('filename.ext' <attachment-options>)
specifies the physical names of the files to be attached to the message and any options to modify attachment specifications. Enclose filename.ext in quotation marks. To attach more than one file, enclose the group of filenames in parentheses. For example, attach='/u/userid/opinion.txt' and attach=("june11.txt" "july11.txt") are valid file attachments.

 

Respected Advisor
Posts: 4,779

Re: SAS Enterprise Guide Email Multiple Attachments

@ColeG

Not sure but could it be that if you can't use default attachment options that you need to repeat them after every single attachment?

May be worth a test.

Ask a Question
Discussion stats
  • 4 replies
  • 776 views
  • 0 likes
  • 4 in conversation