Data visualization with SAS programming

How to get a file figurename.EPS with ODS GRAPHICS?

Reply
New Contributor
Posts: 2

How to get a file figurename.EPS with ODS GRAPHICS?

Hi,

I am currently working in an environment which (for further processing) requests the SAS graphics either in a catalog (as with the former PROC GPLOT) or if not, then a file with extension .eps.

But I want to create my graphics with PROC SGPLOT (SAS 9.2 is available). But I dont seem to get my figure from SGPLOT with ODS GRAPHICS into a File as "figurename.eps" .

The nearest I got was the following code, but when I try to view my .eps file for example with Word, then only "codetext" is shown.

goptions reset=all device=sasprtc vsize=5in;

ods listing close;

ods printer printer="PostScript EPS Color"

file="&path/figurename.eps" startpage=never;

run;

ods graphics on;

proc sgplot data=aaa;

... some statements ;

run;

ods graphics off;

run;quit;

ods printer close;

ods listing;

I tried also with ODS HTML and device=eps, but that didnt work at all. I always got the following message:

WARNING: Unsupported device 'EPS' for HTML destination. Using default device 'PNG'.

WARNING: tagsets.HTML4 destination does not support EPS images. Using the default static format.

Any Ideas what I am doing wrong?

Would it be possible to get the ODS GRAPHICS into a catalog? I am not very familiar with the two graphic worlds, least of all their differences ...

If I dont find a solution, I will have to re-pogramm my figures with PROC GPLOT.   Smiley Sad

Daniela

Valued Guide
Posts: 765

Re: How to get a file figurename.EPS with ODS GRAPHICS?

hi ... there may be an easier way, but this will at least get postscript (there's no encapsulated postscript IMAGEFMT)

there are free tools for PS to EPS conversion if you really need EPS

ods latex path="z:\";

ods graphics on / imagefmt=ps imagename='plot';

proc sgplot data=sashelp.class;

  scatter x=height y=weight / group=sex;

run;

ods graphics off;

ods latex close;

from page 4 in ... Creating Statistical Graphics in SAS 9.2: What Every Statistical User Should Know

SAS Super FREQ
Posts: 925

Re: How to get a file figurename.EPS with ODS GRAPHICS?

This can also be done with ODS LISTING. ODS LATEX is not required.

SAS Super FREQ
Posts: 925

Re: How to get a file figurename.EPS with ODS GRAPHICS?

Also, using IMAGEFMT=EPSI instead of PS should give you eps output.

Valued Guide
Posts: 765

Re: How to get a file figurename.EPS with ODS GRAPHICS?

hi ... just curious, if I use this ...

ods latex path="z:\";

ods graphics on / imagefmt=epsi imagename='plot';

proc sgplot data=sashelp.class;

  scatter x=height y=weight / group=sex;

run;

ods graphics off;

ods latex close;

I know where the EPS file is located, in folder Z:\

if I use the default LISTING destination (no path allowed), where does the EPS file go

ods graphics on / imagefmt=epsi imagename='plot';

proc sgplot data=sashelp.class;

  scatter x=height y=weight / group=sex;

run;

ods graphics off;

SAS Super FREQ
Posts: 925

Re: How to get a file figurename.EPS with ODS GRAPHICS?

You can use the GPATH option on ODS LISTING to control that output location.

Valued Guide
Posts: 765

Re: How to get a file figurename.EPS with ODS GRAPHICS?

Hi, thanks ... works like a charm.  Time to learn more about the the SG PROCS and all extra stuff (e.g. how to direct output) that I understand in the "non SG world".

New Contributor
Posts: 2

Re: How to get a file figurename.EPS with ODS GRAPHICS?

Great,

thank you both! It WorksSmiley Happy

It can be so easy when you know, where to define the format ...

Super Contributor
Posts: 296

Re: How to get a file figurename.EPS with ODS GRAPHICS?

I am still confused about available fileformats with ODS graphic. And I would therefore like to repeat the original question: Does anyone know how to produce graphics in EPS format with ODS?

From the documentation it seems that EPS should work with the ODS LISTING destination, but in practice it doesn't. The error message is

"ERROR: Unsupported image file format for output file."

Also, EMF format shold be possible with the RTF-destination. Then I get this error message:

"ERROR: Trying to open a key that does not exist: CORE\PRINTING\PRINTERS\\DEFAULT SETTINGS"

In practice, I therefore often use the old method where I produce the graphics with annotate and gplot. And I can put it to almost whatever format I want with the device option.

Jacob

Ask a Question
Discussion stats
  • 8 replies
  • 5728 views
  • 6 likes
  • 4 in conversation