Data visualization with SAS programming

Ods EMF Output SAS 9.4

Accepted Solution Solved
Reply
Occasional Contributor
Posts: 19
Accepted Solution

Ods EMF Output SAS 9.4

I want to output my sgplot using EMFdual. I have tried several different options but the only option that has worked for me so far is:

ods graphics on / noborder;

ods html close ;

ods printer printer=emfplus;

This will print an EMF graph (print from my printer). Other options I have used appear to generate EMF but they are really PNGs.  This is obvious when I increase the size of the image.  If I can print an EMF, why cant I output it to a file? 


Accepted Solutions
Solution
‎03-27-2017 10:38 AM
Grand Advisor
Posts: 10,211

Re: Ods EMF Output SAS 9.4

Have you tried IMAGEFMT=EMFDual on the ODS Graphics statement?

 

 

View solution in original post


All Replies
Solution
‎03-27-2017 10:38 AM
Grand Advisor
Posts: 10,211

Re: Ods EMF Output SAS 9.4

Have you tried IMAGEFMT=EMFDual on the ODS Graphics statement?

 

 

Occasional Contributor
Posts: 19

Re: Ods EMF Output SAS 9.4

This worked!!

Thank You Ballardw!

Occasional Contributor
Posts: 19

Re: Ods EMF Output SAS 9.4

Ballardw,

My graph is width=4.5in height=3in, would you happen to know how I could get rid of the rest of the white space in my output?

Grand Advisor
Posts: 10,211

Re: Ods EMF Output SAS 9.4

Did you try specifing you desired height and width on the ods graphichs options statement?

Otherwise you may have to post a picture to indicate which white space and the procedure used to create it. If you need to do this the PNG style output would be preferable if it looks the same.

Occasional Contributor
Posts: 19

Re: Ods EMF Output SAS 9.4

I found that frame=off border=off distorted my image but if I use

options papersize=("4.5" "7") my image remains the same.

Grand Advisor
Posts: 10,211

Re: Ods EMF Output SAS 9.4

PAPERSIZE is not an option for ods graphics. It can affect document margins though.

 

ods graphics / width=5in height=6in;

You can use any of the measurement units such as cm, mm, pt (printers point) or px (pixels).

 

Border=off if used corretly should not "distort" image just remove lines around the graphic display area but since border may appear in many places it is hard to guess what may have happened. Frame can be something entirely different and I would have to see the entire syntax you used to guess what may have happened.

If you change the size of the graphics area you may want to consider using NOSCALE option to keep text size from getting enlarged/shrunk in proportion to the graphic display area

Occasional Contributor
Posts: 19

Re: Ods EMF Output SAS 9.4

ods _all_ close;

ods graphics on / reset=all width=4.5in height=3.0in noborder IMAGEFMT=EMFdual;

ods html close ;

ods printer printer=emfdual;

options nodate nonumber papersize=(4.8in 3.0in);

I still too much white space but the papersize seems to be working.  I can not get my grafout or file name to work.  Any suggestions on what might work?

This is the error I am getting.  It still generates an emf though.

ods _all_ close;

NOTE: ODS PRINTER printed no output.

(This sometimes results from failing to place a RUN

statement before the ODS PRINTER CLOSE statement.)

381 ods graphics on / reset=all width=4.5in height=3.0in

381! noborder IMAGEFMT=EMFdual;

-------

1

WARNING 1-322: Assuming the symbol EMF was misspelled as

EMFdual.

382 filename 'D:\Data\Whitney Parkhouse\SAS Programs\SAS Graph

382! Demo';

ERROR: Invalid logical name.

ERROR: Error in the FILENAME statement.

383 ods html close ;

384 ods printer printer=emfdual;

 

Valued Guide
Posts: 505

Re: Ods EMF Output SAS 9.4

This seems to produce an emf file. SAS does seem to default to png
especially with goptions, evem with device=EMF?


/* first 64 bytes of graph file */
/*   d              @          LO  `;   EMF   j  Þ       */


ods listing style=journal;
ods listing  gpath='d:/emf';
ods graphics on / width=8in imagefmt=emf imagename="emf";
proc sgplot data=sashelp.class;
scatter x=height y=weight / group=sex;
run;quit;
ods graphics off;


Grand Advisor
Posts: 17,358

Re: Ods EMF Output SAS 9.4

@rogerjdeangelis I think GOPTIONS are for SAS/GRAPH procedures and ODS GRAPHICS are for SG Procedures.

Valued Guide
Posts: 505

Re: Ods EMF Output SAS 9.4

Thanks Reeza

 

Learned somrthing new.

 

 You are correct, when I was using goptions SAS ignored goptions and  'defaulted' to png.

Occasional Contributor
Posts: 19

Re: Ods EMF Output SAS 9.4

 

This was new information for me too. Thanks Reeza

Occasional Contributor
Posts: 19

Re: Ods EMF Output SAS 9.4

Thank You rogerjdeangeli!

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 12 replies
  • 331 views
  • 1 like
  • 4 in conversation