Hi - How can I style only one word in a paragraph within PROC ODSTEXT, e.g. how would I make bold just the word here in the following code snippet?
ods html close;
options nodate;
title 'Using PROC ODSTEXT';
footnote 'The ODS Destination for PDF';
ods pdf file="temp.pdf";
proc odstext;
p 'I want to style just one word; HERE';
p 'You can also format your text.' / style=[color=red fontsize=25pt];
run;
ods _all_ close;
Hi:
ODS ESCAPECHAR to the rescue! When you want to change the style of one word in a cell or text string, then you use a feature called "in-line formatting" using ODS ESCAPECHAR. Basically, you declare a character to get ODS attention and then you specify your style string in curly braces with the style attributes you are changing in square brackets, as shown here:
ods pdf file='c:\temp\use_bold.pdf' ;
ods escapechar='^';
options nodate;
title 'Using PROC ODSTEXT';
footnote 'The ODS Destination for PDF';
proc odstext;
p 'I want to style just one word; ^{style[color=purple fontweight=bold fontsize=25pt]HERE}^{newline 2}';
p 'You can ^{style[textdecoration=underline]also} format your text.' / style=[color=red fontsize=25pt];
run;
ods _all_ close;
Partial PDF results:
There have been a LOT of postings -- search on ESCAPECHAR or on in-line formatting.
cynthia
Hi:
ODS ESCAPECHAR to the rescue! When you want to change the style of one word in a cell or text string, then you use a feature called "in-line formatting" using ODS ESCAPECHAR. Basically, you declare a character to get ODS attention and then you specify your style string in curly braces with the style attributes you are changing in square brackets, as shown here:
ods pdf file='c:\temp\use_bold.pdf' ;
ods escapechar='^';
options nodate;
title 'Using PROC ODSTEXT';
footnote 'The ODS Destination for PDF';
proc odstext;
p 'I want to style just one word; ^{style[color=purple fontweight=bold fontsize=25pt]HERE}^{newline 2}';
p 'You can ^{style[textdecoration=underline]also} format your text.' / style=[color=red fontsize=25pt];
run;
ods _all_ close;
Partial PDF results:
There have been a LOT of postings -- search on ESCAPECHAR or on in-line formatting.
cynthia
I'm trying to highlight a sentence without success. Is this even possible in PROC ODSTEXT
ODS PDF FILE="xxx.pdf"
STYLE =styles.minimal
PDFTOC =2
AUTHOR ='RTI International'
ANCHOR ='SNFRM_REPORT'
BOOKMARKLIST =none
BOOKMARKGEN =NO
COMPRESS =9
COLOR =FULL
SUBJECT ="Skilled Nursing Facility Quality Measure"
KEYWORDS ="Skilled Nursing Facility 30-Day All-Cause Readmission Measure (SNFRM)"
TITLE ="The Skilled Nursing Facility Value-Based Purchasing Confidential Feedback Quarterly Report";
;
ODS ESCAPECHAR='^';
FOOTNOTE2 j=center color=black font="Times" height=11pt "1";
ODS PDF STARTPAGE=NO;
/* ----------------------------------------------------------------- */
ODS PROCLABEL "Opening";
PROC ODSTEXT;
cellstyle 1 as {font_size=11pt font_weight=medium just=l font_face=Times};
p "Below you will find the layout of this report that will be furnished to you quarterly via the Nursing Home Compare Confidential WEB Portal, beginning October, 2016. ^S={backgroundcolor=yellow font_size=11pt font_weight=bold fontstyle=italic just=l font_face=Times}This document does not include individual SNF performance at this time, but rather is intended to inform you of the SNF VBP measure and the data source used to calculate measure performance.";
Hi:
My memory is that ODS PDF can only have 1 color for the background in a cell, so do not think your backgroundcolor=yellow is going to work. You can however italicize, bold and change the size and foreground color for just part of the text within 1 cell as shown below.
I did simplify your code a bit and I changed from the original style ODS ESCAPECHAR to the most current (SAS 9.2) "ESCAPECHAR function" format for using ODS ESCAPECHAR. Everything except backgroundcolor worked for me. I had to doctor my screen shot and make the full text of the paragraph smaller, so it would fit in the screen shot.
If you really need the background color for your sentence to be yellow, I don't think you can do that with PDF.
Cynthia
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.