BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.

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
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
Pyrite | Level 9

Wonderful!

Many many thanks @Ksharp !

 

- Dr. Abhijeet Safai

Dr. Abhijeet Safai
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
Pyrite | Level 9
@A_Kh, Thank you.

I remember now that it's traffic lighting! 👍

- Dr. Abhijeet Safai
Dr. Abhijeet Safai
Associate Data Analyst
Actu-Real

sas-innovate-2024.png

Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.

 

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
  • 220 views
  • 2 likes
  • 3 in conversation