BookmarkSubscribeRSS Feed
Banker123
Calcite | Level 5

Hey guys,

im using ods rtf to output graphics into Word. Thats working as expected. But after that i need to convert the word into a pdf-file and print the document (on paper). Both in the file and on paper the graphics do not look as expected (lines getting thinner). 

 

Im using the option device = SASEMF. I figured out that this problem does not exist with "png" but the quality (and the required disk space) is unacceptable with png, so i need to stick with SASEMF. I also figured out that this problem does not exist with gplot (without "s") (even if im using SASEMF). 

Im not able to use ods pdf directly as the grahics need to get into word first.

 

graphic in word (his is what the graphic should look like)

Banker123_0-1599203697376.png

graphic printed to paper / pdf

Banker123_1-1599203715884.png

example code (SAS Enterprise Guide 7.15):

 

ods rtf file='test.rtf' ;

goptions device = SASEMF

keymap = UNIXMAP

hsize = 20 cm

vsize = 10 cm

ftitle = '<ttf> Arial'

 

;

proc sgplot data = test description="Test" uniform=scale;

xaxis values = (1 2 3 4 5 6 7);

yaxis label = "test" min = 0 integer;

y2axis label = "test" min = 0 max = 1;

needle x = xvalue y = yvalue1 / legendlabel = "test1"

lineattrs = (thickness = 6pt)

 

;

series x = xvalue y = yvalue2 / y2axis legendlabel = "test2"

lineattrs = (thickness = 0)

markers markerattrs = (symbol = diamondfilled)

 

;

series x = xvalue y = yvalue3 / y2axis

legendlabel = "test3"

lineattrs = (thickness = 3pt)

 

;

keylegend / noborder position = topleft across = 1;

run;

ods rtf Close;

 

15 REPLIES 15
DanH_sas
SAS Super FREQ

Can you post the test data as well?

Banker123
Calcite | Level 5

test data ist attached. It does not reproduce exactly the shown pictures (e.g. colors), but anyway the problem occurs with every kind of data or graphic style

DanH_sas
SAS Super FREQ

Okay, there are a couple of items here:

1) When using an SG procedure (which is part of the ODS Graphics system), you should not use the SAS/GRAPH GOPTIONS statement to set the device. Instead, use the OUTPUTFMT option on the ODS Graphics statement. You can see that usage in the program below.

 

2) Even using SASEMF with OUTPUTFMT gives the same result you describe. I believe the issue involves how dimensions like "6pt" are resolved and put into the EMF output. However, there is an alternative that should work well for you. Instead of using ODS RTF, you can use ODS WORD instead with an OUTPUTFMT of SVG. This will give you the vector-based quality you want, but translates well when exported from the WORD application.

 

Hope this helps!

Dan

 

ods word file='test.docx' ;
keymap = UNIXMAP
hsize = 20 cm
vsize = 10 cm
ftitle = '<ttf> Arial'
;

ods graphics / outputfmt=svg;
proc sgplot data = test description="Test" uniform=scale;
xaxis values = (1 2 3 4 5 6 7);
yaxis label = "test" min = 0 integer;
y2axis label = "test" min = 0 max = 1;
needle x = xvalue y = yvalue1 / legendlabel = "test1"
lineattrs = (thickness = 6pt);
series x = xvalue y = yvalue2 / y2axis legendlabel = "test2"
lineattrs = (thickness = 0)
markers markerattrs = (symbol = diamondfilled);
series x = xvalue y = yvalue3 / y2axis
legendlabel = "test3"
lineattrs = (thickness = 3pt);
keylegend / noborder position = topleft across = 1;
run;

ods word Close;
Banker123
Calcite | Level 5

hi,

thanks for your reply. It seems like SVG does not work:

 

WARNING: Word destination does not support SVG images. Using the default static format.

 

DanH_sas
SAS Super FREQ

What version of SAS are you running?

DanH_sas
SAS Super FREQ

That sounds like an Enterprise Guide version. Do you know the version of the SAS server you are using on the backend?

 

Try submitting this command and post what comes out in the log:

 

%put &sysvlong;

 

Thanks!
Dan

Banker123
Calcite | Level 5

9.04.01M6P110718

Banker123
Calcite | Level 5

hello everyone, so there is no solution to my problem?

DanH_sas
SAS Super FREQ

The SVG support in ODS WORD was not added until SAS 9.4m7. It appears you are running SAS 9.4m6; so, unfortunately, that support is not available to you.

 

The issue that you're seeing might be related to the difference in DPI between the generated RTF file and the Pdf generated from Word. Do you know the DPI used by Word for the PDF output? I believe this can be found and adjusted in the "Advanced" settings. The default DPI for ODS RTF output is 200dpi (This can be adjusted using the IMAGE_DPI option on the ODS RTF statement). My recommendation is to try setting IMAGE_DPI=300 on the ODS RTF statement and set 300dpi in the Word settings to see if the output is kept consistent. Let me know if that works for you.

 

Thanks!

Dan

Banker123
Calcite | Level 5

Unfortunately setting image_dpi to 300 in SAS and Word (or pdf printer) did not work.

DanH_sas
SAS Super FREQ

I ran some experiments to see if I could get Word to maintain the line thicknesses of vector-based from ODS RTF when exporting PDF. Unfortunately, I could not find any settings or set any line thickness units where Word maintained the thickness. ODS WORD output works as expected, but it requires SAS 9.4m7 of greater to generated vector-based output.

 

The only alternative I know for you is to set OUTPUTFMT=PNG on the ODS GRAPHICS statement to generate image output in your ODS RTF output. That will convert to PDF as expect. You can use the IMAGE_DPI option on the ODS RTF statement to control the image quality. 

ballardw
Super User

@Banker123 wrote:

hi,

thanks for your reply. It seems like SVG does not work:

 

WARNING: Word destination does not support SVG images. Using the default static format.

 


Your initial post says "im using ods rtf to output graphics into Word". That message sounds a lot like you are not using RTF but ODS WORD.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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
  • 15 replies
  • 4528 views
  • 2 likes
  • 4 in conversation