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-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

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.

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