Using PROC ODSTEXT to generate the body of an email, extra spaces are being inserted into the text after 136 or more characters. The code renders correctly in SAS Studio but not in the generated email. The email has a space embedded in the email address in the text, making it inactive as a link.
ods listing;
ods MSOFFICE2k body=outbox style=sasweb;
title;
footnote;
* Enter the body of your email with a 'p' statement within the PROC ODSTEXT procedure block;
proc odstext;
p 'Aloha,' /style={fontsize=12pt};
p "^{newline}";
p "Here is your updated list of roles that currently contain staff out due to Covid. Please use this data to validate staffing on your unit."/ style={fontsize=12pt};
p "^{newline}";
list /style={fontsize=12pt};
item "If you see incorrect information (i.e. someone is back and the report says they are still out) please email SomeEmailAddress@MyCompany.com"/ style={liststyletype="disc"};
item "This data is also being sent to your directors/VP and if you have a pertinent issue with staffing please reach out to them for assistance."/ style={liststyletype="disc"};
item "If you have an employee on this list that is no longer reporting to you, please disregard. There may be a lag in PeopleSoft for transfers."/ style={liststyletype="disc"};
end;
p "^{newline}";
p "Attached report prepared for: &Name" /style={fontsize=12pt};
p "^{newline}";
p "Mahalo," /style={fontsize=12pt};
p "^{newline}";
p "ITIM-Support@queens.org" /style={fontsize=12pt};
* p "www.queens.org" /style={fontsize=12pt};
run;
ods listing close;
ods _all_ close;
The listing destination is just the normal old SAS PRINT text file. That is limited to lines that are no longer than the LINESIZE setting. Is that what is happening to you? What is the current setting for the LINESIZE option when you ran the code?
Why do you have the ODS LISTING turned on? What are you planning to do with that plain text output?
Is that what you are trying to use as the body of your email?
Look to the source of the email address.
Such addresses want pretty plain text. I suspect that you might have a non-standard character in the data source that when treated as an email address is "padding" with a space when trying to use something with national language characters.
Or just plain has a space in the source that you missed.
Are you using macro code at all? remote submitting code via SAS/Connect? Both of those sometimes have issues with getting confused about parsing code and the effect sometimes looks like inserted word boundaries.
Thanks everyone for reviewing this thread and offering sugestions. The solution was easier than I had anticipated.
Since I was not able to find a solution in previous papers or the SAS documentation, I started experimenting with the code. By removing the LRECL=256 options from the FILENAME EMAIL statement, the embedded extra spaces were removed from the email. It occurred to me that since the text was formatted correctly in the SAS Studio Results window, the issue must have been occuirring when SAS submitted the email instructions to the MS Exchange server for rendering in Outlook.
Remonvig the LRECL=256 option from the FILENAME EMAIL statement resolved the issue.
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 25. Read more here about why you should contribute and what is in it for you!
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.