hi,
I would like to show one of my column headers as
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:
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 :
Please advise if it is possible to mark my header as
Thanks
Hi:
I found that it worked better if I used the unicode instruction for superscript 2:
Cynthia
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}
Hi:
I found that it worked better if I used the unicode instruction for superscript 2:
Cynthia
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
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.
Ready to level-up your skills? Choose your own adventure.