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

EG: 7.15

EG Program creates an Excel file on UNIX SAS Grid.

When attached to a EG Generated email the attachment (email generation is fine) is corrupt and can not be opened.

User gets the 1st warning message then the 2nd MS noted file corrupt message.

When moved (FTP) to local desktop the Excel file opens fine.

Any thoughts... TIA

 

Here is the EG SAS Code...

 

/* Setting up email routine to email the Excel to the users */
/******************************************************************/
FILENAME mymail EMAIL
Attach = '/xx/xx/Metric_ReWrite/Acctname_Metric_MatchStatus.xlsx';
RUN;

 

DATA _null_;
FILE mymail;
PUT "!EM_TO! (&NOTIFY.)";
PUT "!EM_CC! (&NOTIFYCC.)";
PUT "!EM_REPLYTO! (&REPLYTO.)";
PUT "!EM_SUBJECT! Testing Email Of Client Master List VS Master_New (File From UNIX SAS GRID)";
PUT " ";
PUT " *** Testing to see if the Excel is still corrupt *** ";
PUT " ";
PUT "** Confirm Attachment: Acctname_Metric_MatchStatus.xlsx";
PUT " ";
PUT " ";
PUT "<EOF> End Of Testing <EOF>";
PUT " ";
RUN;

1 ACCEPTED SOLUTION

Accepted Solutions
JayS
Obsidian | Level 7

After digging around this nice simple code worked...

Thanks, Jay

 

filename outbox email
      from='abc@abc.com'
	  to='abc@abc.com' 
	  type='text/html'
	  subject='Test Mail'
	  attach=("/user/test.xlsx" content_type="excel");
	  
ods html body=outbox rs=none style=Htmlblue;

proc odstext;
p 'Hello,';
p ' Please find the attachment';
p 'Thank You';
title;
run;
ods html close;

View solution in original post

4 REPLIES 4
JayS
Obsidian | Level 7

Added the code, seems to include another file as an attachment, that is not an excel file.
It's odd as the new file has part of the email message in the file.

I have to open in Notepad to read it...

Still digging, thanks.

Jay

JayS
Obsidian | Level 7

After digging around this nice simple code worked...

Thanks, Jay

 

filename outbox email
      from='abc@abc.com'
	  to='abc@abc.com' 
	  type='text/html'
	  subject='Test Mail'
	  attach=("/user/test.xlsx" content_type="excel");
	  
ods html body=outbox rs=none style=Htmlblue;

proc odstext;
p 'Hello,';
p ' Please find the attachment';
p 'Thank You';
title;
run;
ods html close;
Tom
Super User Tom
Super User

Why are you sending an HTML file but pretending it is an XLSX file?

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 1030 views
  • 0 likes
  • 3 in conversation