BookmarkSubscribeRSS Feed
Pyrite | Level 9

I have a code as show below. Image is being inserted if I use ODS output.

Is there a way to display contents with image in the output window without using ODS output file?

I am using this code in EG. 

With PC SAS, it works fine, however when I use EG, how do you code/point image location ?

Eventually, I am going to create a store process, and job will be scheduled to be run off the store process server.

dm 'log' clear;
dm 'Output'  clear;

data a;
input Indicators $  SALCD $ Total;
A M 10
A N 22
A O 35
A P 41
B M 5
B N 9
B O 15
B P 29

proc sort data=a; by indicators;run;

proc transpose data=a out=b;
by indicators;
id salcd;
var total;
proc sort data=b    nodupkey;
   by m_n_diff;

data fmt;
   set b ;
   fmtname = "mypic";
   start = m_n_diff;
   label = "d:\arrow_png"||put(m_n_diff,4.)||".jpg";
    keep start fmtname label;

proc format cntlin=fmt;
run;  */
proc format;
value  colorfmt
low-0 = 'navyblue'
0  = 'CX23d8FF'
0-high = 'lightblue'
value mypic
low-0  = "Green_down.jpg"
10-high  = "Green_up.jpg"
0      = "right.jpg"
value difffmt
low - <-10 = 'red'
-10 - 0 = 'green'
other = 'beige'
value blank other=" ";
* ods html close;
* ods html body ="d:\arrows_jpg\test.html";
title1 ' ';

%let curr_90= 27 MAR 2012 ;
proc report data=b  nowd headline headskip  style=[/*preimage="d:\arrows_jpg\up_new.jpg" */ background=mypic.];
column indicators ("Curr Prev 90 Days - &CURR_90" m n m_n_diff  m_n_perc)('Curr Prev 12 Months' o p o_p_diff o_p_perc) ;
define indicators /group;   
define n /display;
define m_n_diff /computed center style=[ foreground=difffmt.    preimage=mypic.     ]   ;
define m_n_perc /computed center format=percentn8.2 style=[     preimage=mypic.    ]  ;
define o_p_diff /computed center style=[ foreground=difffmt.    preimage=mypic.     ]  ;;
define o_p_perc /computed center format=percentn8.2 style=[ /*background=difffmt.*/    preimage=mypic.    ]  ;
compute o_p_perc;
    m_n_diff = m.sum - n;
   m_n_perc = (m.sum-n)/m.sum;
   o_p_diff = o.sum - p.sum;
   o_p_perc = (o.sum-p.sum)/p.sum;

compute before _page_ / center style=[font_weight=bold foreground=black background=white];
line 'Income by RC';

* ods  listing;



  What you ask just doesn't make sense to me. The piece of SAS that you are using with this syntax (for example):

style=[ foreground=xxxx    preimage=yyyy    ]

is an ODS STYLE= statement level override that is specifically designed to be how PROC REPORT interfaces with ODS for the express purpose of changing style attributes, in destinations that support style changes.

So when you say that you want to "display contents" with the image but "without using ODS output file" -- there's no way to use PREIMAGE or FOREGROUND= without using ODS.

However, your question about EG or a Stored Process and the location of the preimage is a different (partly answerable) question. The answer is, it depends... on the type of output you are creating. If you are creating HTML output, then generally, the location of the PREIMAGE is the location on the web server or server machine, where the image will be accessed when the HTML page is loaded into the browser. On the other hand, if you are creating RTF or PDF output, then the location of the image needs to be the location where the image is located when the RTF file or PDF file is created.

The bottom line is that you probably will not be able to specify just 1 location for all scenarios for running your code -- in PC SAS, a local file location for the PREIMAGE will probably work. For EG, with SAS on the server, you may need to specify a server location for the image file, either a location on the SAS server (if creating RTF or PDF output) or a location on the web server (where the final HTML page will be stored). For a stored process, you may have to specify a location on the stored process server for the image (which means that you may need to move the image over to the stored process server in a directory location) or you may have to specify the location on another server, whereever you might be loading the output files for subsequent viewing.

Your best bet for resolving this would be to work with Tech Support to get some help figuring out the EXACT location you need for PREIMAGE for each of your code execution scenarios (PC, EG, stored process server). (And, for right now, let's just assume that Web Report Studio is not in the picture because we won't say anything about how images have to be registered in the metadata to use with Web Report Studio reports.)

Asking whether you can somehow use PREIMAGE without using ODS is not where you should start, however. PREIMAGE is only possible because of how it works with ODS. So your question needs to be how to make PREIMAGE work with ODS for all your scenarios.


Pyrite | Level 9


Thanks for your "fundamental" response.

While cutting & pasting code, I took it out ODS HTML BODY=..... line of code.

I will be contacting SAS Tech Support staff.


Girish Patel

Calcite | Level 5

Hi, Girish Patel.

I am so gald to see that your problem had been solved so quickly. But I wonder whether I can create a web-based image viewer to help me display images with the help of some manual image processors which can be customized by users according to our own favors. I am testing about the related programs these days. And I am almost a green hand on this project. Do you have any ideas about it? Or any good suggestion? Thanks in advance.

Best regards,


Fluorite | Level 6

Hey, arronlee, I think you can receive a better and faster solution for creating your web image viewer if you open a new thread. You said you want to display image with image processors, what does that mean exactly? Do you mean the function to edit displayed image on web? If yes, I think following post can help you. Smiley Happy

web applications - Open Source Web Based Image Editor - Stack Overflow


Available on demand!

Missed SAS Innovate Las Vegas? Watch all the action for free! View the keynotes, general sessions and 22 breakouts on demand.


Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

Find more tutorials on the SAS Users YouTube channel.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 4 replies
  • 4 in conversation