The SAS Output Delivery System and reporting techniques

Ods rtf and graphics

Reply
Contributor
Posts: 43

Ods rtf and graphics

Dear all,

I am trying to create a report with tables and graphics via ods rtf but I have a little problem with my graphics. If I run proc gchart without the rtf sentence it works as it is desired but if I export the graph with ods rtf the graph is completly changed. The font style and size, the size of the boxes, etc is changed.

I have the following warning message only using ods rtf:

WARNING: Font arial could not be used.

But, evidently I have this font.

Thanks for your help!
Sincerely,
Juan Vte.
Super Contributor
Posts: 291

Re: Ods rtf and graphics

Juan;

It would be most helpful if you could post some of the program code that you are using ...
Contributor
Posts: 43

Re: Ods rtf and graphics

Thanks Bill,

Here we have an example:

data ex;
input class $2. value;
cards;
C1 10
C2 15
C3 8
C4 4
;
run;


goptions ftext='Arial' htext=1.5;
axis1 value=(h=1.5 f='Arial' a=0 r=0) label=('Value' f='Arial' h=2);
axis2 value=(h=1.5 f='Arial' a=45 r=0) label=('Class' f='Arial' h=2);

proc gchart data=ex;
vbar class / discrete outside=sum sumvar=value raxis=axis1 maxis=axis2 space=4 width=10;
run;
quit;

ods rtf;

proc gchart data=ex;
vbar class / discrete outside=sum sumvar=value raxis=axis1 maxis=axis2 space=4 width=10;
run;
quit;

ods rtf close;

Thanks again!
Juanvte
SAS Super FREQ
Posts: 8,864

Re: Ods rtf and graphics

Hi:
This is the best document about creating output for use in Microsoft products:
http://support.sas.com/techsup/technote/ts674/ts674.html

Particularly, section G on ODS RTF.

Several issues could be affecting the creation of your fonts and images:
1) the device driver you choose
--a) if you choose GIF, JPG, EMF, etc, then you do not get ANY style information from ODS Style templates
--b) if you choose ActiveX, Java, Actximg or Javaimg drivers, then style templates are used in the creation of graphical output. (BTW, the look and feel of graphics with these drivers is the look and feel that you will get automatically in SAS 9.2 -- when SAS/Graph respects ODS Style templates for font and color styles.)

2) The GOPTIONS statements that you use (or that are set by default inside EG, for example) might not be the same goptions that you're using in your "batch" job.

3) The standard way that ODS creates images for RTF or PDF is that the images are converted from their SAS/Graph representation into an internal mode used by either Microsoft Word (for RTF) or Adobe format (for PDF). (This is different from how ODS HTML uses SAS/Graph images -- with ODS HTML, an <:IMG> tag is built that points to the location of the graphic file...this is NOT the case with RTF or PDF.) So, you could be experiencing some "translation" issues, too.

In addition, I am not a fan of the ODS RTF; method of invoking ODS RTF (without a FILE= option) because the name of the output file being created is left to ODS and SAS and the output is generally put in your working directory, which in Windows is usually some c:\documents and settings location.

Just to give you an idea of the difference a device driver makes in the creation of graphic output for RTF, run the code below and review the output created by the 3 different drivers. You will notice a dramatic difference between the ACTXIMG output and the JPEG or PNG output. (I did not bother with AXIS statements -- it is a silly graph, but I wanted to show you something simple and keep the code short.

If you factor in GOPTIONS and FONT/COLOR/SYMBOL, etc statements, then you will see that there's a lot that could be affecting your output.

Your best bet for help with SAS/Graph and ODS may be to contact Tech Support to open a track.

cynthia
[pre]

goptions reset=all device=actximg;
ods rtf file='c:\temp\class1_actx.rtf';
proc gchart data=sashelp.class;
vbar sex / discrete outside=sum sumvar=age
space=4 width=10;
run;
quit;
ods rtf close;

goptions reset=all device=jpeg;
ods rtf file='c:\temp\class2_jpeg.rtf';
proc gchart data=sashelp.class;
vbar sex / discrete outside=sum sumvar=age
space=4 width=10;
run;
quit;
ods rtf close;


goptions reset=all device=png;
ods rtf file='c:\temp\class3_png.rtf';
proc gchart data=sashelp.class;
vbar sex / discrete outside=sum sumvar=age
space=4 width=10;
run;
quit;
ods rtf close;
[/pre]
Ask a Question
Discussion stats
  • 3 replies
  • 297 views
  • 0 likes
  • 3 in conversation