BookmarkSubscribeRSS Feed
tburus
Obsidian | Level 7

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.

4 REPLIES 4
Cynthia_sas
Diamond | Level 26

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:

Cynthia_sas_0-1596295289173.png

 



But the nearest I could get in SAS was this:

Cynthia_sas_1-1596295315125.png

 

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

tburus
Obsidian | Level 7

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 :)?

 

frac.png

Cynthia_sas
Diamond | Level 26
Hi:
To open a track with Tech Support, fill out the form at this link: http://support.sas.com/ctx/supportform/createForm
Cynthia
tburus
Obsidian | Level 7

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; 

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and save with the early bird rate—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
  • 1725 views
  • 0 likes
  • 2 in conversation