BookmarkSubscribeRSS Feed
JCatling
Calcite | Level 5

Hello,

I'm attempting to create an email report which includes the results in the email body, and as a HTML attachment. At the moment I'm using a pair of ODS HTML statements and a 'filename email' statement. The code works, but I'm running it through Enterprise Guide 4.1, and it never actually ends until I force it to. The log reports no errors, and if I add anything extra after the email is sent that'll also run fine; Enterprise Guide just doesn't seem to realise that it's reached the end. If I replace the HTML attachment with any other kind the issue goes away, but I'd prefer to keep the attachment as HTML.

Here's a cut-down version of the code, which should demonstrate the problem:

/* Just make a sample table */

PROC SQL;

  CREATE TABLE extfile AS

  SELECT * FROM SASHELP.VEXTFL;

QUIT;

ods html(id=rpout) body="report.html";

filename doemail email to=("example@place.com")

  type='TEXT/HTML'

  subject="Test"

  from= "example@place.com"

  attach= ("report.html");

ods html body=doemail ENCODING='utf-8';

PROC PRINT DATA=WORK.extfile;

  VAR fileref xpath xengine;

RUN;

ods html(id=rpout) close;

ods html close;

Does anyone have any idea what might be causing this?

2 REPLIES 2
Cynthia_sas
SAS Super FREQ

Hi:

  I suspect there may be some timing issues. Generally, I do this for an email and attach example (NOT email in the body of the document).

1) create REPORT file in a separate step

2) issue FILENAME statement

3) use DATA step to send a brief message to initiate the email. This step is NOT inside an ODS "sandwich"

  See the example on page 7 of this paper: http://support.sas.com/resources/papers/proceedings11/300-2011.pdf

  Since you are trying to put the SAME report as an attachment and in the body of the email, you may be confusing ODS. EG just adds a layer of complexity, because EG will  be trying to make report output for you too. If you don't get this resolved yourself, then you might want to work with Tech Support on this question.

cynthia

JCatling
Calcite | Level 5

Thanks, Cynthia. I've just spotted this discussion, which looks like a very similar problem. However, the solutions listed there did not work in my case (and my problem does not trigger unless I have both HTML destinations open at once). Seems like it's probably an EG problem.

I was able to get around the problem by writing my report inside an ODS Document 'sandwich', and then using PROC DOCUMENT to replay it separately for each destination.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 2028 views
  • 0 likes
  • 2 in conversation