BookmarkSubscribeRSS Feed
deleted_user
Not applicable
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
4 REPLIES 4
sbb
Lapis Lazuli | Level 10 sbb
Lapis Lazuli | Level 10
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.
Cynthia_sas
SAS Super FREQ
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
sunny999
Calcite | Level 5

Hello,

 

I have a similar requirement as mentioned above.In my PDF report, In a table I have a column named "Keyword" which contains a word and a second column named "Sentence" which contains text.I want to highlight the "Keyword"  inside the "Sentence" column.

 

For example:

Keyword Sentence 
portfolioA strategy whereby investors or portfolio managers increase or decrease holdings in an entire industry, rather than buying or selling individual stocks from that particular industry. 
redeploymentRebalancing almost always entails the sale of high-priced/low-value securities and the redeployment of the proceeds into low-priced/high-value or out-of-favor securities.

 


SAS version:9.4

Destination of choice: PDF

Report procedure of choice: Proc report

 

Please let me know if it is possible.

 

Thankyou,

Prudhvi.

 

 

Barkat
Pyrite | Level 9

I am using SAS EG (Version: 8.3 (8.3.0.103) (64-bit))

 

How can I bold only the first word (In the following ods pdf text=  statement, "Introduction") in my text in a report? Please see the code below.

ods _all_ close;
ods escapechar='^';
ods pdf style=pearl
file="\\--------------abc.pdf" 
notoc startpage=no NOGTITLE NOGFOOTNOTE style=htmlblue;
options  nodate number leftmargin=.5in rightmargin=.5in;
ods pdf text= "^S={ font_size= 9pt}Introduction: 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.";
ods pdf close;

 

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!

How to Concatenate Values

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.

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
  • 4 replies
  • 3431 views
  • 0 likes
  • 5 in conversation