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

I'm using SAS 9.4 to generate a HTML5 file, works just fine, but when attaching the file to an email, I get the "ERROR: An attachment record was truncated.  The attachment LRECL is too small." error.  I previously got this error in 9.2 and it was fixed by adding the (content_type="text/HTML") from this support paper: 

http://support.sas.com/kb/39/996.html

But for HTML5, it doesn't seem to work, nor does setting LRECL=9999, as other workarounds have suggested.  Any thoughts?

goptions device=png xpixels=1200 ypixels=900;

ODS LISTING CLOSE;

ODS HTML5 options (bitmap_mode='inline')

path='my_path' body="Chart.htm" style=egdefault;

goptions noborder cback=white gunit=pct htitle=6 htext=1.5 ftitle="albany amt/bold" ftext="albany amt";

title1 ls=2 "Title 1";

title2 ls=1 color=red "(Mouse over circles for more info)";

footnote;

symbol1 interpol=join value=dot color=blue height=3;

axis1 order=(70 to 90 by 2)

  label=("Metric")

  minor=none                                                                                                                

  offset=(1,1)                                                                                                                     

  width=1;                                                                                                                         

axis2 order=("01JAN13"d to "31DEC14"d by month)                                                                                                       

  label=none

  value=(angle=45)

  offset=(0,0)                                                                                                                     

  minor=none; 

proc gplot data=my_data;

  plot metric*week / grid vaxis=axis1 haxis=axis2 html=my_html des='' cframe=bwh;

run;

quit;

ODS HTML CLOSE;

ODS LISTING;

option emailhost='localhost';

filename mymail email

  from = "my_email"

  to = "my_email"

  sender="my_email"

  subject="Test HTML"

  attach = ("my_path/Chart.htm" lrecl=9999)

  content_type="text/HTML";

data _null_;

file mymail;

run;

1 ACCEPTED SOLUTION

Accepted Solutions
Kurt_Bremser
Super User

Looks like the bitmap for the graph generates a "line" much in excess of any expected text line size.

Take a look at the generated file and see what is in there, maybe a further increase of lrecl may help.

Another option could be to avoid the "inline" graphics, set ODS so that all output (including the graphs) are stored in a single directory, and then attach all files in the directory to the email, with correct type specification.

Just came to my mind: what if you zip the .htm and attach the zipped file with a correct filetype?

View solution in original post

3 REPLIES 3
Kurt_Bremser
Super User

Looks like the bitmap for the graph generates a "line" much in excess of any expected text line size.

Take a look at the generated file and see what is in there, maybe a further increase of lrecl may help.

Another option could be to avoid the "inline" graphics, set ODS so that all output (including the graphs) are stored in a single directory, and then attach all files in the directory to the email, with correct type specification.

Just came to my mind: what if you zip the .htm and attach the zipped file with a correct filetype?

P5C768
Obsidian | Level 7

The generated graph is only 110 KB, but it does appear that upping the LRECL = 9999999 seems to work (999999 sent the email without the error, but the file wouldn't open).  Does the LRECL statement tie directly to file size?

ballardw
Super User

LRECL => Logical RECord Length , related to the length of any single record. In tabular data that usually corresponds to the content of a single row. Image files however tend not to have a "row" content, just one big long sequence or a single record.

You'll note that the original fix related to Text, not Image which is another type of content.

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