BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
DrAbhijeetSafai
Lapis Lazuli | Level 10

The answer by @Ksharp  for the question related to "Applying superscript to a variable instead of text" was very much helpful and thanks to him once again for that. 

 

I was thinking if it is possible to italicize the text by same way (that is by changing sub or super keyword by some other keyword like italic). If anyone knows about it, please let me know. 

 

Kindly note that it is not the text in title which needs to be italicized but the value in a variable which needs to be italicized. 

 

Thanks in advance! 🙂

 

- Dr. Abhijeet Safai

Dr. Abhijeet Safai
Certified Base and Clinical SAS Programmer
Associate Data Analyst
Actu-Real
1 ACCEPTED SOLUTION

Accepted Solutions
Ksharp
Super User

Yes. You can.

 

data have;
set sashelp.class;
if age >14 then super=cats('(*ESC*){style [font_style=italic]',name,'}');
 else super=name;
run;


ods excel file='c:\temp\temp.xlsx';
proc report data=have nowd;
column name age super;
define name/display;
run;
ods excel close;

Ksharp_0-1714023968517.png

 

View solution in original post

4 REPLIES 4
Ksharp
Super User

Yes. You can.

 

data have;
set sashelp.class;
if age >14 then super=cats('(*ESC*){style [font_style=italic]',name,'}');
 else super=name;
run;


ods excel file='c:\temp\temp.xlsx';
proc report data=have nowd;
column name age super;
define name/display;
run;
ods excel close;

Ksharp_0-1714023968517.png

 

DrAbhijeetSafai
Lapis Lazuli | Level 10

Wonderful!

Many many thanks @Ksharp !

 

- Dr. Abhijeet Safai

Dr. Abhijeet Safai
Certified Base and Clinical SAS Programmer
Associate Data Analyst
Actu-Real
A_Kh
Lapis Lazuli | Level 10

Alternatively, we can use 'style' attributes in proc report directly. 
eg.

ods excel file='want.xls';
proc report data=sashelp.class;
	column age name sex;
	define name/'Name' display;
	define age/'Age' display;
	define sex/'Sex' display;
	compute name;
		if age > 14 then call define(_col_, "Style", "Style=[fontstyle=italic font_weight=bold]"); 
	endcomp;
run; 
ods excel close;

result.
Capture.PNG

DrAbhijeetSafai
Lapis Lazuli | Level 10
@A_Kh, Thank you.

I remember now that it's traffic lighting! 👍

- Dr. Abhijeet Safai
Dr. Abhijeet Safai
Certified Base and Clinical SAS Programmer
Associate Data Analyst
Actu-Real

sas-innovate-wordmark-2025-midnight.png

Register Today!

Join us for SAS Innovate 2025, our biggest and most exciting global event of the year, in Orlando, FL, from May 6-9. Sign up by March 14 for just $795.


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.

SAS Training: Just a Click Away

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

Browse our catalog!

Discussion stats
  • 4 replies
  • 657 views
  • 2 likes
  • 3 in conversation