BookmarkSubscribeRSS Feed
Jim_Cooper_hmsa
Obsidian | Level 7

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;

5 REPLIES 5
Tom
Super User Tom
Super User

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?  

Jim_Cooper_hmsa
Obsidian | Level 7
Tom, Good thoughts. I tested two scenarios that you suggested: I changed the ODS LISTING to ODS HTML and the output in the Outlook email was unchanged. A space was still inserted into the email address in the text. Here is the output (with some confidential info redacted There added spaces throughout the body. This is using the ODS HTML
-------------------------------------------------------------------------------
Aloha,

Here is your updated list of roles that currently contain staff out du e to Covid. Please use this data to validate staffing on your unit.

• If you see incorrect information (i.e. someone is back and the report says they are still out) please email
xxxxxxxxxxxxxxxxxx xxx@xxxxxx.xxx
• 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.
• If you have an employee on this list that is no longer reporting to you, please disreg ard. There may be a lag in PeopleSoft for transfers.

Attached report prepared for: XXXXXXXXXXXXXXXX

Mahalo,
ballardw
Super User

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.

Tom
Super User Tom
Super User

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.  

Jim_Cooper_hmsa
Obsidian | Level 7

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.

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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