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-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
  • 2440 views
  • 1 like
  • 2 in conversation