BookmarkSubscribeRSS Feed
pchappus
Obsidian | Level 7

There has got to be a better way than using the %STR function. I don't particularly like the way I did it because I needed to change my &ValDate variable to be MMDDYY10. instead of WORDDATE. Word date's length will change depending on the month causing all my hard work spacing out the text to create line breaks to change from month to month.

 

Here is my code. (looks like pasting doesn't preserve the spacing but you get the point. I had to add tons of spaces after each line to create line breaks)

 

%LET strEmailBody = %STR(
Hi all,
Attached is the list as of &ValDate to be used for the following:
1. A
2. B as of &ValDate
3. C
4. D
5. E 
Thanks,
Me

*This message was sent automatically from SAS. Please contact me if you no longer need to be on the mailing
list or somebody else needs to be added. Thanks.);

%PUT &strEmailBody;

3 REPLIES 3
HB
Barite | Level 11 HB
Barite | Level 11

I think strEmailBody is a pretty standard thing. 

 

But regarding  " I had to add tons of spaces after each line to create line breaks", have you tried sending HTML email and using <br> and other HTML tags for your formatting?

pchappus
Obsidian | Level 7

I haven't.. how would do something like that? PROC HTML and then use a call symput to create a the macro variable?

HB
Barite | Level 11 HB
Barite | Level 11

 

 

No, I was thinking more like:

 

filename outbox email
   to='susan@site.com'
   type='text/html'
   subject='Temperature Conversions';

 

for your mailing part and then building your string with HTML coding something like

 

strEmailBody = "Hi all, <br>"

strEmailBody = strEmailBody + "Attached is the list as of &ValDate to be used for the following:<br>"

etc

 

I just don't know enough to know if the html tags (<br>, <p>, <emphasis>, etc) will express doing it that way or if you need to use ODS output or what.  

 

I can't help you on the macro or the date issue, I was just thinking about how it might be nicer to use "<br>"

instead of "                                                                                 " to try and force your formatting. 

 

 

 

SAS Innovate 2025: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 2368 views
  • 0 likes
  • 2 in conversation