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
SAS Super FREQ

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
SAS Super FREQ
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; 

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 863 views
  • 0 likes
  • 2 in conversation