SUPPORT / SAMPLES & SAS NOTES
 

Support

Usage Note 24047: In ODS RTF, how can I add images to my output file?

DetailsAboutRate It

Here are two ways you can add images to an RTF file.

  • Beginning with Release 8.2 in ODS RTF, you can add an image before a table with PREIMAGE= and after a table with POSTIMAGE= in PROC TEMPLATE. Below is an example.
       proc template;
         define style styles.test;
           parent=styles.rtf;
           style table from table /
                 preimage='c:\saslog.jpg';
         end;
       run;
    
       ods rtf file='temp.rtf' style=styles.test;
    
       proc print data=sashelp.class;
       run;
    
       ods rtf close;
    
  • Beginning with Release 8.2 in ODS RTF, you can add an image to the beginning of the file by using in-line formatting. This is currently a work-around that adds an image into the TITLE1. For subsequent procedures or DATA steps, remove TITLE1 so the image only appears once.
       ods escapechar='^';
       ods rtf file='temp.rtf';
    
       proc print data=sashelp.class;
         title j=l '^S={preimage="C:\V7image.jpg"} ';
       run;
    
       proc print data=sashelp.class;
         title;
         title2 'this is a test';
       run;
    
       ods rtf close;
    

See more information about PROC TEMPLATE and the RTF destination.



Operating System and Release Information

Product FamilyProductSystemSAS Release
ReportedFixed*
SAS SystemBase SASAlln/a
* For software releases that are not yet generally available, the Fixed Release is the software release in which the problem is planned to be fixed.