Data visualization with SAS programming

ODS Emf Output

Reply
Occasional Contributor
Posts: 19

ODS Emf Output

I have SAS 9.4 and I am trying to generate multiple graphs from a proc template using:

ods _all_ close;

ods graphics on / reset=all width=6.0in height=3.5in noborder IMAGEFMT=EMFdual noscale ;

ods html close ;

ods printer printer=emfdual;

options nodate nonumber printerpath=emfdual;

filename output "d:\data\&var.emf";

 

 

This will only output the first observation of my macro and it completely ignores my output destination.  I have tried other options and most of them appear to generate emf output but they are really PNGs.

Any suggestions ? 

Thanks!

Grand Advisor
Posts: 10,210

Re: ODS Emf Output

If you want the filename to reference a file with an extension of emf change:

filename output "d:\data\&var.emf";

to

filename output "d:\data\&var..emf";

The . following a macro variable tells the macro processor to combine the next text so you need a second one as part of the extension.

 

You will want to add an ods graphics option to specify the graphic immage format

 

ods graphics/ imagefmt=EMF;

When you do not specify and imagefmt the default is chosen based on the target destination and most of those will generate PNG.

Occasional Contributor
Posts: 19

Re: ODS Emf Output

When I made the changes is ignored my filename and created a blank EMF.

Any other suggestions ?

Grand Advisor
Posts: 10,210

Re: ODS Emf Output

Missed tha tyou had immage fmt.

Show the log of the code ran with any messages to include the

 

You aren't referencing the filename for your output on the filepath option.

try changing it to Printerpath(emfdual output);

Output because that is the name of the FILENAME.

It may not hurt to have the printerpath set before the ODS PRINTER statement so that statment knows where things are going.

 

 

You may need to verify that you have a printer emfdual. I know I don't have one.

 

 

SAS Super FREQ
Posts: 889

Re: ODS Emf Output

Instead of ODS PRINTER, try this instead:

 

ods _all_ close;

ods listing gpath="d:\data";

ods graphics on / reset=all width=6.0in height=3.5in noborder IMAGEFMT=EMFdual 

                 noscale imagename="&var..emf";

 

 

 

SAS Super FREQ
Posts: 889

Re: ODS Emf Output

Instead of ODS PRINTER, try this instead:

 

ods _all_ close;

ods listing gpath="d:\data";

ods graphics on / reset=all width=6.0in height=3.5in noborder IMAGEFMT=EMFdual 

                 noscale imagename="&var..emf";

 

 

 

Occasional Contributor
Posts: 19

Re: ODS Emf Output

This code you suggested created files for all observations with the file names to the right destination but the emf files were blank.  Here is the proc template I am trying to generate an emf for  ...

 

%Macro Graph;

proc template;

define statgraph district;

begingraph / datacolors=(white CXEBDDED CXEBDDED CXEBDDED CXEBDDED CXEBDDED CXEBDDED CXEBDDED) ;

layout overlay / walldisplay=(fill) xaxisopts=(display=( line tickvalues)

DISCRETEOPTS=(TICKVALUEFITPOLICY=split TICKVALUESPLITJUSTIFY=center) labelattrs=(family='GraphLabelText' size=10pt))

yaxisopts=( offsetmin=0 linearopts=(viewmin=0 viewmax=&vmax tickvaluelist=(0 &Mid &Max)));

barchartparm x=district y=percent / group=district groupdisplay=cluster errorupper=uppct errorlower=lowpct

ERRORBARATTRS=(color=black)

OUTLINEATTRS=(color=black);

scatterplot y=dataloc x=district / markercharacter=percent MARKERCHARACTERATTRS=(size=10pt FAMILY='GraphValueText');

endlayout;

endgraph;

end;

run;

proc sgrender data=district template=district ;

format district district.;

run;

%Mend Graph;

ods _all_ close;

ods listing gpath="d:\data";

ods graphics on / reset=all width=6.0in height=3.5in noborder IMAGEFMT=EMFdual

noscale imagename="&var..emf";

/*Output(Var,Max,vmax,Mid,Lev)*/

%Output (Z_GENHLT, 50,50, 25, 2, );

%Output (Z_HCCOVR, 50,50, 25, 2, ) ;

ods graphics off;

Ask a Question
Discussion stats
  • 6 replies
  • 194 views
  • 0 likes
  • 3 in conversation