BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
ducdien
Calcite | Level 5

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

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
jklaverstijn
Rhodochrosite | Level 12

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

5 REPLIES 5
jklaverstijn
Rhodochrosite | Level 12

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.

ducdien
Calcite | Level 5

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

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


jklaverstijn
Rhodochrosite | Level 12

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.

ducdien
Calcite | Level 5
Thank you!


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