BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
tjbrandeis
Fluorite | Level 6

Hello:

I've searched the boards and have seen a number of questions on exporting editable graphics from SAS Studio but none of the proposed solutions have worked for me. I'm trying for an EMF file, if possible, but anything editable outside the SAS environment would be fine (this point is non-negotiable - our publications group needs editable graphics so please don't tell me to just format the graphics in SAS and export an image file). The most recent error message I get (repeated several times) is: 

 

" WARNING: html5 destination does not support EMF images. Using the default static format."

 

The code otherwise runs fine and I get boxplots as both .emf and .sge which I can download but they are not editable; just images. Maybe my problem is not knowing how to edit these files, but inserting them into Word and PowerPoint doesn't allow any ungrouping or editing of the image.

 

The graphics output options in PROC MIXED seem more limited than in other procedures but I'm still trying the options. If exporting within SAS, then graphing/formatting with another procedure is an option, that would be good, too.

 

Here is my code, pointing the output to the SAS Studio server folder I can access, and using code from examples the community have provided to others with this issue:

 

ods rtf file = '/home/u58490928/sasuser.v94/growth/test.emf' image_dpi= 300 sge = on;
ods graphics on / outputfmt=emf;
 
proc mixed data=growth.undamaged_conds method=reml plots=boxplot(observed);
class island ftypen cid invyr;
model tpa_live=ftypen / solution;
random island;
repeated invyr /subject=cid type=ar(1);
lsmeans ftypen / cl pdiff;
run;
 
ods rtf close;
ods graphics off;
1 ACCEPTED SOLUTION

Accepted Solutions
JeffMeyers
Barite | Level 11
You need to have the full file path before the file name in the ods rtf statement. It's trying to write it to the temp directory and that's not allowed.

Also do you have Adobe acrobat pro or illustrator? You could instead output to pdf and make editable figures.
You would use ods pdf like the following:
Options device=sasprtc;
Ods _all_ close;
Ods pdf file="filepath/filename.pdf" notoc;
Ods graphics / outputfmt=static;
code here. Use ods select to grab just graph output from procedure as needed.
Ods pdf close;

View solution in original post

7 REPLIES 7
Kathryn_SAS
SAS Employee

Here is a blog that may help you get started:

https://blogs.sas.com/content/sgf/2021/08/17/editable-emf-graph-output/ 

 

For the Warning message, you can try adding the following before your opening ODS RTF statement:

 

ods _all_ close;

Quentin
Super User

As mentioned in the comments of the blog post that Kathryn linked to, you might also try using SVG format.

The Boston Area SAS Users Group is hosting free webinars!
Next up: Lisa Mendez & Richann Watson present Get Tipsy with Debugging Tips for SAS® Code: The After Party on Wednesday Jul 16.
Register now at https://www.basug.org/events.
tjbrandeis
Fluorite | Level 6

Thank you, Kathryn. Your suggestion got rid of the error messages. Unfortunately, the blog post instructions have not worked so far. I've added their suggested steps and attempted to out and .emf file but just get zero byte files.


%let workdir=%trim(%sysfunc(pathname(work)));
data _null_;
file "&workdir./emf94.sasxreg";
put '[CORE\PRINTING\PRINTERS\EMF\ADVANCED]';
put '"Description"="Enhanced Metafile Format"';
put '"Metafile Type"="DUAL"';
run;
proc registry import="&workdir./emf94.sasxreg";
run;

 

I'm trying Quentin's suggestions of an .svg file but so far only get .html files with the graphics embedded in a form that won't open in anything but a browser (disappear when inserted into Word or PowerPoint, and don't seem to be selectable in the html file). This is what I've come up with so far to get anything but a zero byte file, preceding my PROC MIXED statements.


ods _all_ close;
ods html5 file = '/home/u58490928/sasuser.v94/growth/tpa.html' style=journal;
ods graphics / imagefmt=svg imagename="tpa";

ods html5 options (svg_mode="inline");
ods graphics /imagefmt=svg;

 

I'll keep at it but I'm getting frustrated that something that should be simple is so complicated (and so far, non-functional).

 

Kathryn_SAS
SAS Employee

You are writing to HTML5 but the log shows this:

WARNING: html5 destination does not support EMF images.

I can write to an RTF file using the following:

%let workdir=%trim(%sysfunc(pathname(work)));
data _null_;
   file "&workdir./emf94.sasxreg";
   put '[CORE\PRINTING\PRINTERS\EMF\ADVANCED]';
   put '"Description"="Enhanced Metafile Format"';
   put '"Metafile Type"="DUAL"';
run;
proc registry import="&workdir./emf94.sasxreg";
run;

ods _all_ close;
ODS RTF file="Test Case2.rtf" nogtitle nogfootnote style=journal; 

ods graphics on / reset=all outputfmt=emf attrpriority=none;

options nodate nonumber; 	

title1; 

data cars; 
  set sashelp.cars;
  where Make="Audi" or Make="BMW" or Make="Honda";
run;

PROC SGPLOT data=cars; 
	step  y=weight x=Horsepower /group=make ;
    styleattrs datacontrastcolors=(red blue green);
RUN; 

ODS RTF close; 
ODS LISTING ; 

If you continue to have problems, I would suggest opening a case with Technical Support  and include you SAS log.

tjbrandeis
Fluorite | Level 6

I tried your code, Kathryn, but got an error which I've been seeing a lot this morning:

 

ERROR: Insufficient authorization to access /pbr/biconfig/940/Lev1/SASApp/Test Case2.rtf.
ERROR: Fatal ODS error has occurred. Unable to continue processing this output destination.
WARNING: No body file. RTF output will not be created.

 

Below is my current code. Is it time for Technical Support?

 

%let workdir=%trim(%sysfunc(pathname(work)));
data _null_;
file "&workdir./emf94.sasxreg";
put '[CORE\PRINTING\PRINTERS\EMF\ADVANCED]';
put '"Description"="Enhanced Metafile Format"';
put '"Metafile Type"="DUAL"';
run;
proc registry import="&workdir./emf94.sasxreg";
run;

ods _all_ close;
ODS RTF file="Test Case2.rtf" nogtitle nogfootnote style=journal;

ods graphics on / reset=all outputfmt=emf attrpriority=none;

options nodate nonumber;

title 'TPA by forest type, blocking on island';
proc mixed data=growth.undamaged_conds method=reml plots=boxplot(observed);
class island ftypen cid invyr;
model tpa_live=ftypen / solution;
random island;
repeated invyr /subject=cid type=ar(1);
lsmeans ftypen / cl pdiff;
*ods output SolutionF=solution_fixed;
run;

ODS RTF close;
ODS LISTING ;

 

JeffMeyers
Barite | Level 11
You need to have the full file path before the file name in the ods rtf statement. It's trying to write it to the temp directory and that's not allowed.

Also do you have Adobe acrobat pro or illustrator? You could instead output to pdf and make editable figures.
You would use ods pdf like the following:
Options device=sasprtc;
Ods _all_ close;
Ods pdf file="filepath/filename.pdf" notoc;
Ods graphics / outputfmt=static;
code here. Use ods select to grab just graph output from procedure as needed.
Ods pdf close;
tjbrandeis
Fluorite | Level 6

Thank you, Jeff. I guessed at where to modify the path and that worked. I was able to export an .rtf file which has the boxplots as objects that could be converted to Microsoft Drawing objects which I could then edit in Word.

 

I will also try .pdf files with Adobe Acrobat Pro (assuming my agency has not revoked our rights to use that again) which I think our publications people can use, too.

 

I'll work with what I can do now. Thank you all for your help. I've leared a lot today.

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 7 replies
  • 579 views
  • 0 likes
  • 4 in conversation