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

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1373 views
  • 0 likes
  • 2 in conversation