I am trying to style a fraction into an RTF document using native RTF code, but can't seem to get it right. I have seen some example of how this is done with other mathematical symbols and structures, but not fractions. Below is what I've tried. The first piece works (borrowed from "To ODS RTF and Beyond"). The second piece is my own attempt and does not yield the desired result (a vertical fraction of a/b).
data t;
length x $150;
x="{A capital sigma: \field{\*\fldinst {EQ \\I\\su(i=1,n, ) }}}";
output;
x="{\field{\*\fldinst {EQ \\mf\\mnum(a)\\mden(b)}}}";
output;
run;
ods rtf style=plain;
proc report data=t noheader nofs style={protectspecialchars=off rules=none};
run;
ods rtf close;
I am not married to using RTF codes. If another approach works better, I'd be happy to use it.
Hi:
It's not clear to me what you are trying to achieve. When I use Microsoft Word, I have to do an Insert Symbol to get the Sigma and Insert Equation to get vertical fraction as shown below using only Word tools:
But the nearest I could get in SAS was this:
The fraction doesn't look quite the way you implied.
I think you might need some kind of equation editor to get the vertical fraction or maybe a math font. If there's a way to do this in RTF control strings, I'm not sure. You might want to check with Tech Support.
Cynthia
When I run the code above I get the sigma with sub and superscripts to display just fine. I imagine there is some sort of similar way to style fractions using the \mf \mnum and \mden control codes, I just can't seem to work it out. Do you have Tech Support's number :)?
Thanks. I actually just found it. Appears MS Word doesn't use all the same RTF codes. This is what I needed:
data eq1;
length x $150;
x="{\field{\*\fldinst {EQ weight = \\F(a, b)}}}";
output;
run;
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!
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.