DATA Step, Macro, Functions and more

Email from SAS with bold font

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 16
Accepted Solution

Email from SAS with bold font

[ Edited ]

Hello

 

I am trying to send email from SAS to multiple recipients using a macro and want to bold part of the sentence. However, it seems the "bold" does not work with a macro variable

 

This works

put '.Message1 { color: Red; font-size: 10pt; font-weight: bold; }';

 

put ' <span class="Message1"> your facility is selected </span>';

 

But this does not

put '.Message1 { color: Red; font-size: 10pt; font-weight: bold; }';

put ' <span class="Message1"> &facilityname is selected </span>';

 

when I run the macro, it does not replace the facilityname with the name, but keep &facilityname as bold type

 

Any suggestion?

 

Thank you

 

 


Accepted Solutions
Solution
‎03-03-2016 08:56 AM
Super Contributor
Posts: 408

Re: Email from SAS with bold font

[ Edited ]

Looks like you have the macro variable reference &facilityname between single quotes. In that case the reference is not resolved. Use double quotes and you'll be fine. You will also have to double up on the existing double quotes to retain them between double quotes (still with me?).

 

 

put " <span class=""Message1""> &facilityname is selected </span>";

 

Good luck

- Jan.

View solution in original post


All Replies
Solution
‎03-03-2016 08:56 AM
Super Contributor
Posts: 408

Re: Email from SAS with bold font

[ Edited ]

Looks like you have the macro variable reference &facilityname between single quotes. In that case the reference is not resolved. Use double quotes and you'll be fine. You will also have to double up on the existing double quotes to retain them between double quotes (still with me?).

 

 

put " <span class=""Message1""> &facilityname is selected </span>";

 

Good luck

- Jan.

Occasional Contributor
Posts: 16

Re: Email from SAS with bold font

Thank you very much. It works.  Do you have any guidelines or links on how and when to use single and double quotes?

Occasional Contributor
Posts: 16

Re: Email from SAS with bold font

Thank you very much. It works. Do you have any guidelines or links on how and when to use single and double quotes?


Super Contributor
Posts: 408

Re: Email from SAS with bold font

Quite entertaining and informative is this paper: https://support.sas.com/rnd/papers/sgf07/Macros_Dont_Work.pdf

 

The presentation is old but no less useful. Quoting is at the very heart of the macro facility and around since the beinning of times. I would advise to take a broader approach to learning macro and not focus too much now on this topic. It starts easy but can become complicated real fast. There are many good resources; let Google be your guide.

Occasional Contributor
Posts: 16

Re: Email from SAS with bold font

Thank you!


☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 5 replies
  • 254 views
  • 0 likes
  • 2 in conversation