I would like to know if I can have imagamap functionality when using png format.
I create several png filles with proc sgplot, then I use proc gslide and I end up putting it all together with proc greplay.
It works but I don't succeed in activating the imagemap functionality.
And furthermore I cannot find the NOGTITLE option I use with pdf output, in the final greplay output the charts' title don't show up.
Any idea?
Here's the relevant code I use (only an excerpt and without data):
ODS LISTING GPATH='C:\Users\DKXENLO\Desktop\OUTOUT' IMAGE_DPI=300;
ODS GRAPHICS ON/RESET=INDEX IMAGENAME="_06" IMAGEMAP=ON WIDTH=10IN HEIGHT=5IN;
PROC SGPLOT DATA=SKODA_SCORE;
TITLE "RESTRICTED BRAND+VWFS FABIA REGRESSION, BY FUEL";
WHERE MODELEUROTAX = "FABIA";
FORMAT YHAT PERCENT9.0;
SERIES Y=YHAT X=MESES_EFECTIVOS / GROUP=COMBUSTIBLE DATASKIN=SHEEN TRANSPARENCY=0.6;
XAXIS VALUES=(0 TO 72 BY 12);
YAXIS VALUES=(0.3 TO 0.7 BY 0.1) VALUESHINT GRID;
RUN;
ODS LISTING CLOSE;
ods listing close;
goptions reset=all device=png300
xmax=5in ymax=3.8in;
/* more sgplot and gslide */
GOPTIONS IBACK="C:\Users\DKXENLO\Desktop\OUTOUT\_061.PNG" IMAGESTYLE=FIT;
PROC GSLIDE;
RUN;
QUIT;
GOPTIONS RESET=ALL HSIZE=10IN VSIZE=5IN;
ODS LISTING CLOSE;
ods html file="C:\Users\DKXENLO\Desktop\OUTOUT\6ER2.htm"
nogtitle gpath="C:\Users\DKXENLO\Desktop\OUTOUT\" image_dpi=400 ;
ODS GRAPHICS ON/ IMAGEMAP=ON imagename='SIX2' width=7in height=5in;
proc greplay NOFS IGOUT=GSEG TC=SIXGRAPHS;
/*NOFS: TO SUPRESS PROC GREPLAY SCREEN
IGOUT: TO SELECT GRAPHICS CATALOG
TC: STORED NAME OF THE TEMPLATE CREATED*/
TDEF SPEC6
1/ULX=0 ULY=100 URX=33 URY=100
LLX=0 LLY=51 LRX=33 LRY=51
COLOR=BLACK
2/ULX=34 ULY=100 URX=66 URY=100
LLX=34 LLY=51 LRX=66 LRY=51
COLOR=BLACK
3/ULX=67 ULY=100 URX=100 URY=100
LLX=67 LLY=51 LRX=100 LRY=51
COLOR=BLACK
4/ULX=0 ULY=50 URX=33 URY=50
LLX=0 LLY=0 LRX=33 LRY=0
COLOR=BLACK
5/ULX=34 ULY=50 URX=66 URY=50
LLX=34 LLY=0 LRX=66 LRY=0
COLOR=BLACK
6/ULX=67 ULY=50 URX=100 URY=50
LLX=67 LLY=0 LRX=100 LRY=0
COLOR=BLACK
;
TEMPLATE SPEC6;
TREPLAY 1:1 2:2 3:3 4:4 5:5 6:6;
DELETE _ALL_;
RUN;
ODS HTML CLOSE;
ODS LISTING;
If I read the GREPLAY code correctly it looks like you are doing a 2 row 3 column playback to get six images in one.
What I do not see is code that I can clearly see creating six images unless you are running the Proc Sgplot with 6 different values of MODELEUROTAX . If that is the case you might want to consider moving to proc sgpanel, use MODELEUROTAX as the PANELBY variable and then specify Columns=3 and rows=2 and ONEPANEL as options for the panel by statement. Then all of the graphs appear as single image and there should be less concern about the imagemap options working, which I suspect is an issue with greplay. Greplay is really intended for use with the older device graphic files and they had no concept of tooltips or such things. So I am not sure if greplay would create a combined image that could do that.
SGPANEL syntax is basically the same for the plot elements but has added bits to control things like common/uncommon y-axis appearance on rows and such and some appearance items related to the location of the Panelby variable information.
The imagemap option requires the HTML destination to be open. From you code it is not clear whether you have an active ODS HTML destination (results window) when the SGPLOT code runs.
Thank you @ballardw
I'm honest when saying that I'm glad that this code gives more or less the desired result. There's a lot of trial and error in it.
GLIDE and GREPLAY are strange creatures to me.
And I don't know where to place the HTML command.
My first doubt is regarding the png files I create at the first step. Can this format convey the tip information I get normally when outputting to an HTML destination?
When I output HTML then GSLIDE stops working.
Can you give me any further hint to a possible solution?
If I read the GREPLAY code correctly it looks like you are doing a 2 row 3 column playback to get six images in one.
What I do not see is code that I can clearly see creating six images unless you are running the Proc Sgplot with 6 different values of MODELEUROTAX . If that is the case you might want to consider moving to proc sgpanel, use MODELEUROTAX as the PANELBY variable and then specify Columns=3 and rows=2 and ONEPANEL as options for the panel by statement. Then all of the graphs appear as single image and there should be less concern about the imagemap options working, which I suspect is an issue with greplay. Greplay is really intended for use with the older device graphic files and they had no concept of tooltips or such things. So I am not sure if greplay would create a combined image that could do that.
SGPANEL syntax is basically the same for the plot elements but has added bits to control things like common/uncommon y-axis appearance on rows and such and some appearance items related to the location of the Panelby variable information.
Thanks a lot.
Your inference is correct, I use 6 times SGPLOT before combining them in a 2 rows and 3 columns replay.
Unfortunately, I cannot use SGPANEL as the plot type is not unique.
I'm looking after
GTL LATTICE LAYOUT, perhaps this will be easier to control.
@acordes wrote:
Thanks a lot.
Your inference is correct, I use 6 times SGPLOT before combining them in a 2 rows and 3 columns replay.
Unfortunately, I cannot use SGPANEL as the plot type is not unique.
I'm looking after
GTL LATTICE LAYOUT, perhaps this will be easier to control.
Quite possible the GTL is the better solution.
But perhaps showing the code you are using for the 6 SGPLOTS would provide clues. As long as the Xaxis are common it could be quite doable to make an SGPANEL though it may require a little data modification to get different topics. An indication of the ranges of y variables would be helpful.
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
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.