BookmarkSubscribeRSS Feed
nirali514
Obsidian | Level 7

Can you underline one word in an ods text =  statement?

 

For example:

 

ods text= "^S={ font_face = 'Times New Roman' just=j fontweight=light fontsize=12pt color=black}Background:For this project, we are looking for..."

 

I would like to ONLY underline the word "Background" above.

 

Thanks!

3 REPLIES 3
lopezr
Obsidian | Level 7

Here are 2 options:

 

Option 1 using inline formatting:

ods text= "^S={ font_face = 'Times New Roman' just=j fontweight=light 
fontsize=12pt color=black textdecoration=underline}Background 
^S={font_face = 'Times New Roman' just=j fontweight=light 
fontsize=12pt color=black}: For this project, we are looking for...";

Option 2 if you are using RTF then you can use RTF control words to control style:

ods rtf file="UnderlineOneWord.rtf";
ods text= "^S={ font_face = 'Times New Roman' just=j fontweight=light fontsize=12pt color=black protectspecialchars=off}
\ul{Background}\ul0 : For this project, we are looking for...";
ods rtf close;
HB
Barite | Level 11 HB
Barite | Level 11

Theoretically, you could use CSS styles and use a pseudo class:

 

p:first-word{text-decoration:underline;}

but I don't think that is supported. 

 

 

I can do this:

ods listing;
ods html file="text.html" style=mystyle;
ods pdf file="text.pdf" startpage=never notoc style=mystyle;
ods rtf file="text_trad.rtf" style=mystyle;
ods escapechar='^';

title "January Orders ";
footnote " For All Employees";

ods text="My text 1";

ods text="^S={textdecoration=underline}My^S={} Text 2"; 

data grades;
   input id grade1 grade2 grade3 grade4;
datalines;
1105 1 2 3 4
1106 2 2 2 2
1107 3 3 4 6
;
run;

proc print data=grades;
run;

ods text="My Text 3"; 

ods pdf close;

ods rtf close;

title;
footnote;

proc template;
   delete mystyle;
   run;

The key statement there is 

 

ods escapechar='^';

 

and then its use with

^S={textdecoration=underline}My^S={}

 

See if that gets you anywhere.

nirali514
Obsidian | Level 7

Thank you, this helps!

SAS Innovate 2025: Register Now

Registration is now open for SAS Innovate 2025 , our biggest and most exciting global event of the year! Join us in Orlando, FL, May 6-9.
Sign up by Dec. 31 to get the 2024 rate of just $495.
Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 1115 views
  • 0 likes
  • 3 in conversation