The SAS Output Delivery System and reporting techniques

ODS PDF Text Underline

New Contributor
Posts: 3

ODS PDF Text Underline

I'm having an issue with my underlines not fully covering all the text I am trying to underline. The code I am using is:


ods text='^S={font=("Times New Roman",8pt,bold) textdecoration=underline}RECIPIENT DATA';

But the output is showing as this:





We are using SAS 9.4.



Super User
Super User
Posts: 9,416

Re: ODS PDF Text Underline

That looks to be more the renderer than SAS.  What is the output destination?  Is it Word (which is notoriously bad at headings and such like since the Navigation object came in).

New Contributor
Posts: 3

Re: ODS PDF Text Underline

I'm outputting straight to an adobe acrobat pdf.

Super User
Posts: 13,315

Re: ODS PDF Text Underline

Does it work without the BOLD?

I'm thinking that what ever calculates lengths might not quite get the character modification from the BOLD option correct. Try the "Times New Roman Bold" font if you have it available.

New Contributor
Posts: 3

Re: ODS PDF Text Underline

Even completely removing the font statement from the style statement doesn't fix it.


Could the regions and proc report directly below it have an impact?

 For example this section does the same thing:


ods layout start width=7in height = 11in;
ods region x = .25in y = 0in width= 4in height = 4in;
ods text = '^S={font=("Times New Roman",8pt,bold) textdecoration=underline}EMPLOYER RENEWAL FORMS';
ods region x = .25in y = .25in width= 4in height = 4in;
proc report data=renewal_data&yr.;
	columns status cnt;
	define status / display '' style=[cellwidth=2.0in];
	define cnt    / display '' format=comma9. style=[cellwidth=0.5in];
Posts: 9,323

Re: ODS PDF Text Underline

Hi, I doubt that the PROC REPORT step would be impacting the ODS TEXT=. When I ran this simple test, just using nothing but ODS TEXT and a modified form of your style override, I got the same results. I was playing around with font and size and bold separately and I wanted to be sure they were all separate, so I split out the FONT= that you had into separate values. I also played with the "old" syntax vs the "new" syntax and that didn't make a difference.

I think you should open a track with Tech Support on this.


My test code:
ods escapechar='^';

ods pdf file='c:\temp\test_underlineyyy.pdf' startpage=no;
ods text='^S={fontfamily="Times New Roman" fontsize=8pt fontweight=bold textdecoration=underline}RECIPIENT DATA';
ods text='^{style[fontfamily="Times New Roman" fontsize=8pt fontweight=bold textdecoration=underline]RECIPIENT DATA}';
proc print data=sashelp.class(obs=3);
ods pdf close;
Super User
Posts: 10,689

Re: ODS PDF Text Underline

It worked for me. 

Can you pad some characters after it and make underline longer ?


ods pdf file='/folders/myfolders/x.pdf';
ods escapechar='^';
ods text="^S={font=('Times New Roman',8pt,bold) textdecoration=underline}RECIPIENT DATA ^S={color=white}dummy";
proc print data=sashelp.class;run;
ods pdf close;
Posts: 71

Re: ODS PDF Text Underline

[ Edited ]

A customer raised the same problem. I tried TEXTDECORATION = UNDERLINE, but did not work for ODS TEXT for whatever reason.


Only the following PROC ODSTEXT statement gave acceptable results in the PDF document. I also noted that PROC ODSTEXT does not inherit the UserText style elements that ODS TEXT uses.


proc odstext;
       style=[font_size = 10pt
                 foreground = black
                 font_weight = bold
                 borderbottomcolor = black
                 borderbottomwidth = 0.1pt
                 background = white];


/* The next line also needed a top margin to apply line spacing */

ods text = "^S={font_size = 8pt font_style = italic margintopwidth = 8pt}Incidents Reported is based on head office received date.";

Ask a Question
Discussion stats
  • 7 replies
  • 6 in conversation