BookmarkSubscribeRSS Feed
Max06
Calcite | Level 5

I am using SAS9.2, and I have some picture files of charts (not produced with sasgraph) in both .emf and .png format. I would like to drop them all into a single file to email out. I have tried ods rtf/pdf/html output all for both. PNG images are too grainy in each ODS destination to read text overlaid on the charts, and I receive the following errors for .EMF depending on the ODS destination. Any help would be much appreciated! Ultimately I am relatively indifferent to printing to pdf, html or rtf as long as I can size the images appropriately and have them be readable.

  • ODS PDF
    • .emf pictures give "unable to load image" error. One of the three says "the absolute region was too small to accommodate the text supplied. output was lost"
  • ODS HTML
    • .emf pictures don't give an error in log but don't show up in the output report.
  • ODS RTF
    • .emf pictures cause error. says image type is unsupported or file is corrupted.

-----------------------------------------------------------------

I am using a dummy dataset and preimage to print the images (code snippet below):

options orientation=landscape;

ods html file="&Output\testreport.html" style=HighContrast;

ods layout start columns=1 column_widths=(7in);

data dummy; x='"'; run; /*dummy data file to print chart images as backgrounds to empty proc report pages*/

proc report data=dummy nowd; Title; column x; define x /'' style=[preimage="&picturespath.&fuelpricechart.&reportdate.&ext."]; run;

proc report data=dummy nowd; Title; column x; define x /'' style=[preimage="&picturespath.&stockpricechart.&reportdate.&ext."]; run;

proc print data=dataset1;

Title "Title for Dataset1";

run;

ods html close;

ods layout end;

Max

2 REPLIES 2
ballardw
Super User

You might try ODS TAGSETS.MSOFFICE2K but I'm guessing here.

I would try a very basic document with no options or layout to start.

Cynthia_sas
Diamond | Level 26

Hi:

  I saw -almost- the same thing. PDF gave me an error message:

ERROR: Image file type is not supported, or corrupted file.

ERROR: Unable to load image c:\temp\kermit.emf.

ERROR: Unable to load image c:\temp\kermit.emf; default image will be used instead.

NOTE: There were 1 observations read from the data set WORK.DUMMY.


The RTF file did not contain any images.

I was able to get an HTML file with a valid IMG tag for both pictures. I used slightly different syntax than you did. IMAGE_DPI didn't seem to have any impact on how the pictures looked.

I put in the same file twice (KERMIT.EMF) -- the resolution was not good - -certainly, it didn't look as good in the HTML file as the original HTML file.

Below is the code I used. You say that these pictures were created by some other process. You might try annotating them into a new image using SAS/GRAPH Annotate facility. Or you might try working with Tech Support on this question. I'm not sure that using PROC REPORT is the right approach. But if there is a way to do what you want, Tech Support will be able to point you in the right direction. And if there's not a way to do what you want, they will save you a lot of failed attempts.

I put my image in c:\temp\kermit.emf and wrote my output there, too.

cynthia

data dummy;
  x = '_';
run;
    
ods html path='c:\temp' (url=none) file="showkermit.html"
     style=HighContrast ;
 
Title "Title for Dataset1";
 
proc report data=dummy nowd noheader
  style(report)={outputwidth=100% rules=none frame=void
                 cellspacing=0
                 preimage="kermit.emf"};
column x;
define x /''
   style(column)=[background=white just=c
                  foreground=white
                  preimage="kermit.emf"];
run;
 
ods _all_ close;
 
ods rtf file='c:\temp\showkermit.rtf' ;
ods pdf file='c:\temp\showkermit.pdf' ;
Title "Title for Dataset1";

proc report data=dummy nowd noheader
  style(report)={outputwidth=100%
                 preimage="c:\temp\kermit.emf"};
column x;
define x /''
   style(column)=[background=white just=c
                  foreground=white
                  preimage="c:\temp\kermit.emf"];
run;

ods _all_ close;
  


html_with_kermit.png

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
  • 2 replies
  • 2822 views
  • 0 likes
  • 3 in conversation