DATA Step, Macro, Functions and more

How to bold a word in sentence

Reply
N/A
Posts: 0

How to bold a word in sentence

I have a sentence like '' My name is XYZ''

I want to make bold the word XYZ

how it possible by SAS

Thanks in advance.

Leena
Super Contributor
Super Contributor
Posts: 3,174

Re: How to bold a word in sentence

Please explain a bit more how you intend to use the data - output in a report, what format (RTF, HTML, PDF)? SAS version would also help?

Scott Barry
SBBWorks, Inc.
SAS Super FREQ
Posts: 8,742

Re: How to bold a word in sentence

Hi:
The concept of a variable and the value for a variable isn't the same in SAS as it is in Excel or Word. For example, in Word or Excel, you would type a sentence and then highlight the word you wanted to have bold and then click the B (bold icon) on the toolbar.

SAS data values are different from what you see in Word or Excel. SAS data values do not have colors or fonts applied to them as they are stored in the SAS data set. However, when you create a REPORT that shows the data values, you can apply different colors and fonts to either a whole data value or part of a data value. The destination that you choose for your report must, however, support style changes -- for example -- in the LISTING or Output window, style changes (such as changing fonts, colors or font weight (bold) are not supported. But in destinations like HTML, RTF or PDF, you can write reports which have an entire cell in a different color or font or just have 1 word in a data value in a different color or font.

The technique that you use will depend on the report procedure that you're going to use. If you were going to use PROC PRINT or PROC TABULATE, then you might need to "pre-process" your data value ahead of time, if you only wanted 1 word in a data value to have different formatting.

If you were going to use PROC REPORT, then you could "pre-process" your data or you could make your change in a COMPUTE block.

In either case, the feature that allows you to apply "in-line" formatting to just one word in a data value is through the use of the ODS ESCAPECHAR capability. As Scott said, it would be useful to know:
-- what version of SAS (9.1.3 or 9.2) -- because there are different ESCAPECHAR syntaxes
-- what is your destination of choice (RTF, PDF, HTML)
-- what is your report procedure of choice
-- what code are you working with already

cynthia
Ask a Question
Discussion stats
  • 2 replies
  • 208 views
  • 0 likes
  • 3 in conversation