BookmarkSubscribeRSS Feed
Min3
Calcite | Level 5

I created a macro, and try to use the macro to send a .sas7bdat file to an email. And I got the error message of "ERROR: An attachment record was truncated. The attachment LRECL is too small.", even after I specified the LRECL=32767, and file type as filetype=application/octet-stream, extension = sas7bdat. The code is as below.

 

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

 

%macro email2box(emailaddress=, filepath=, filetype=);

filename MailBox email "&emailaddress" attach="&filepath";

 

data _null_;
file MailBox;
put '!EM_ATTACH!' "&filepath" LRECL=32767;
put '!EM_CONTENTTYPE!' "&filetype" extension = 'sas7bdat';

run;

%mend email2box;

 

%email2box(emailaddress=abc@u.box.comm,filepath=/box/icon_lab.sas7bdat, filetype=application/octet-stream);

5 REPLIES 5
pink_poodle
Barite | Level 11
There does not seem to be a fix for this error yet:
https://support.sas.com/kb/39/996.html
ballardw
Super User

Another option would be to create a transport file using proc Cport. This will require a recipient to use Proc Cimport to bring it into the SAS system but these files are intended for interchange between different systems, are text files and may be less sensitive to things that binary files encounter and may be preferred if sending to different operating systems.

Min3
Calcite | Level 5

Thanks everybody for your replies.

 

I tried 

filename MailBox email
  to="&emailaddress"
  attach=("&filepath" content_type="application/x-sas")
;

But somehow, it still doesn't work for me. 

pink_poodle
Barite | Level 11
It does not work for me either - does not give an error, just doesn’t send any email.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!

Submit your idea!

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
  • 5 replies
  • 748 views
  • 1 like
  • 4 in conversation