The SAS Output Delivery System and reporting techniques

Style just one word in a paragraph using PROC ODSTEXT

Accepted Solution Solved
Reply
Frequent Contributor
Posts: 78
Accepted Solution

Style just one word in a paragraph using PROC ODSTEXT

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;

 


Accepted Solutions
Solution
‎06-12-2016 09:04 PM
SAS Super FREQ
Posts: 8,781

Re: Style just one word in a paragraph using PROC ODSTEXT

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:

 

escapechar.png

 

  There have been a LOT of postings -- search on ESCAPECHAR or on in-line formatting.

 

cynthia

View solution in original post


All Replies
Solution
‎06-12-2016 09:04 PM
SAS Super FREQ
Posts: 8,781

Re: Style just one word in a paragraph using PROC ODSTEXT

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:

 

escapechar.png

 

  There have been a LOT of postings -- search on ESCAPECHAR or on in-line formatting.

 

cynthia

Frequent Contributor
Posts: 78

Re: Style just one word in a paragraph using PROC ODSTEXT

Great - worked perfectly! Thank-you also for the "search terms" ..
Regular Learner
Posts: 1

Highlight a sentence in PROC ODSTEXT

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.";

Richard F. Pickett, Research Systems Programmer/Analyst 1
Health Data Informatics (HDI)
eHealth, Quality & Analytics (eQUA)
Social Policy, Health, and Economics Research (SPHERE)
Social, Statistical, & Environmental Sciences (SSES)
RTI International
3040 Cornwallis Road
250 Hobbs
Research Triangle Park, NC 27709-2194
Phone: 919.316.3798
Fax: 919.485.5589
mailto:rpickett@rti.org

turning knowledge into practice
☑ This topic is solved.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 539 views
  • 1 like
  • 3 in conversation