BookmarkSubscribeRSS Feed
jmck
Fluorite | Level 6

I am formatting a report in Proc Report on SAS Viya. I have a column of data that has several Pathogen names. I need to italicize part of the name. For instance, for Salmonella spp., I only need the Salmonella portion italicized. I am using the following compute command:

 

compute Pathogen ;
if Pathogen="Salmonella spp." then do ;
Pathogen='^{style[fontstyle=italic]Salmonella}^';
end ;
endcomp ;

 

It works except it is truncating my variable to show only Salmo in italics. Anybody know why it isn't printing the whole word? Once I fix that, how do I add the "spp." back on in non-italics? THANKS!!! (should also mention I'm using ods escapechar="^")

1 REPLY 1
PaigeMiller
Diamond | Level 26

Use the ODS ESCAPECHAR command and the appropriate modifications of you text string. Examples: https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/odsug/p11xia2ltavr8ln17srq8vn4rnqc.htm#p0xwm6...

--
Paige Miller

SAS Innovate 2025: Call for Content

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!

Submit your idea!

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
  • 1 reply
  • 897 views
  • 0 likes
  • 2 in conversation