BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
Chang
Quartz | Level 8

hi,

 

I would like to show one of my column headers as 

 

h2.png

 

where h is italicized, and 2 is not italicized and in superscript. This symbol is commonly used to mean heritability estimate in genetic studies.  

 

I ended up trying a mixture of RTF control words /i and ^{sup 2} to get the italic effect and to mark 2 in superscript. But I am able to just italicize h. It is not clear to me how to end the RTF effect. I haven't find a reference that uses ^{ } to italicize characters but it would be great if this is possible. The RTF control words appear to apply an effect to every character within the quote. But what I need is different effects on different characters.    

 

I have built a macro for writing repetitive DEFINE column / display "header"  for me. It has been working well. My column headers are shown in the cName= option when the macro is called.

 

Here is my macro:

 

 

 

%macro def_display(	cVar=			/*character variable*/	
					,cName=						/*name of the character variable*/	
					,isFmt=N						/*apply a format to the variable or not*/	 
					,cFmt=							/*which format*/	
					,cWide=25pt				/*cell width*/
					,headerAlign=center 	/*alignment of header text in a column: left, center, right*/
					,colAlign=right 			/*alignment of content in a column: left, center, right, d (decimal point) */
					,marginRight=0
					,background=white 		/*color of background in a column*/
					,foreground=black		/*color of foreground (i.e. font color) in a column*/
					);

	define	&cVar.	/	display	"&cName." 	
		%if &isFmt.=Y %then 
			%do;
					format= &cFmt.
					style(header)={just=&headerAlign.}
					style(column)={just=&colAlign. cellwidth= &cWide. rightmargin=&marginRight. background=&background. foreground=&foreground.};
			%end;
		%else	
			%do;
					style(header)={just=&headerAlign.}
					style(column)={just=&colAlign. cellwidth= &cWide. rightmargin=&marginRight. background=&background. foreground=&foreground.};
			%end; 
%mend def_display;

 

When the macro is called as:

 

%def_display(	cVar=h2_liab ,		cName=\i h \sup 2,	 cWide=1 cm,	headerAlign=right, colAlign=right);

 

It gives a h2 header as this output:

SAS_ODS_RTF_h2.png

 

When the macro is called as :

 

%def_display(	cVar=h2_liab ,		cName=\i h ^{sup 2},	 cWide=1 cm,	headerAlign=right, colAlign=right);

 

It gives an output as :

SAS_ODS_RTF_h2_2.png

 

Please advise if it is possible to mark my header as 

h2.png

Thanks

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

Hi:

  I found that it worked better if I used the unicode instruction for superscript 2:

unicode_super.png

Cynthia

View solution in original post

2 REPLIES 2
ballardw
Super User

ODS would look something like ^{style[fontstyle=italic]h}^{sup 2}

If the 2 comes out italic then try ^{style[fontstyle=italic]h}^{style[fontstyle=roman]sup 2}

Cynthia_sas
SAS Super FREQ

Hi:

  I found that it worked better if I used the unicode instruction for superscript 2:

unicode_super.png

Cynthia

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
  • 2 replies
  • 2628 views
  • 1 like
  • 3 in conversation