Help using Base SAS procedures

Max length of email message

Super Contributor
Posts: 405

Max length of email message

Hello, I have a process that will send me an email if there are errors found in a log file.  It has been working fine until the other day when I didn't receive the email.  When I checked the data was incorrect but I didn't get to see the log because the file overwrites itself.  The issue that the email didn't go out is that the length of the message was really large.

I'm using code similar to this code:

options emailsys=smtp emailport=89;

filename mymail email "" subject="TEST ERROR";

data _null_ ;

set DataDump ;

file mymail ;

put ErrorText ;

run ;

I want to put checks in so the message will not exceed this size so I can still see that there are issues and check the log right away.  Thank you.

Regular Contributor
Posts: 217

Re: Max length of email message

Posted in reply to jerry898969


My solution has been to write the log to a dataset (proc printto) and attach the file to the email.  In your data _null_ step; can you strip/substr/etc..  ErrorText text into smaller sizes (100 characters) then put the smaller sizes?  For example, I would write DataDump to a file and then attach the file to my email.

Super Contributor
Posts: 405

Re: Max length of email message

jwillis, Thank you so much.  That is a great idea.  I will try that out.  Another thing I was going to try was to limit the number of rows to 100 and at least that would tell me something is wrong and I can get an idea of what the situation is. Thank you

Ask a Question
Discussion stats
  • 2 replies
  • 2 in conversation