Data visualization with SAS programming

Save WEBOUT dataset used by PROC SGPLOT to create imagemap

Reply
Occasional Contributor
Posts: 17

Save WEBOUT dataset used by PROC SGPLOT to create imagemap

Is there a way to save the webout dataset used by the imagemap macro into a SAS dataset? We want to compile a list of image map names and coordinates to create a lookup table for multiple images on a webpage, and we are not having any luck figuring out how to save just the map name and coordinate data produced by PROC SGPLOT and PROC SGRENDER. I'm really hoping there is a way to avoid having to scrape .htm output to create this dataset if at all possible.

PROC Star
Posts: 1,329

Re: Save WEBOUT dataset used by PROC SGPLOT to create imagemap

Interesting idea.  Could you post a little example of code generating the html output with imagemap you like (e.g. PROC SGPLOT on sashelp.class) and also post the imagemap name and coordinates you would like to have output?

 

 

Occasional Contributor
Posts: 17

Re: Save WEBOUT dataset used by PROC SGPLOT to create imagemap

With the example below, I'd like to be able to output the map name and each of that tags attributes in a table.  The section of .htm output that I'd like to convert into a dataset is also shown below. So, I'd have one column that would have the name 'carsSample1' repeated in multiple rows and separate columns for the alt, title, and coords associate with each shape.

 

 

proc template;
define statgraph pieChart;
dynamic _NEGATIVE_;
dynamic _ticklist_;
begingraph / collation=binary datacolors=(cx004B8D cx439639 cxD9541E cx9F218B cxC3A204) ;
EntryTitle "Sample Pie Chart" /;
layout region ;
piechart category=make response=EngineSize / 
datalabellocation=outside ;
endlayout;
endgraph;
end;
define style pieChartStyle;
parent=styles.listing;
style graphfonts from graphfonts / 
'GraphDataFont' = ("Verdana, <MTsans-serif>",7pt) 
'GraphUnicodeFont' = ("<MTsans-serif-unicode>",9pt) 
'GraphValueFont' = ("Verdana, <MTsans-serif>",9pt) 
'GraphLabel2Font' = ("Verdana, <MTsans-serif>",10pt) 
'GraphLabelFont' = ("Verdana, <MTsans-serif>",10pt) 
'GraphFootnoteFont' = ("Verdana, <MTsans-serif>",10pt) 
'GraphTitleFont' = ("Verdana, <MTsans-serif>",11pt) 
'GraphTitle1Font' = ("Verdana, <MTsans-serif>",14pt) 
'GraphAnnoFont' = ("Verdana, <MTsans-serif>",10pt); 
end;
run;

ods listing close;
ods graphics / imagemap=on imageName="carsSample" antialiasmax=10000 imagefmt=png width=300px height=300px ;
 
/* Set path for output */
ods html path=' ' file='carsSample.htm' style=pieChartStyle;
proc sgrender data=sashelp.cars template=pieChart ; 
run;
ods graphics off;
ods html close;
ods listing;
<map name="carsSample1">
<Area shape="poly" alt="Make=Other
Engine Size (L)= 830.6" title="Make=Other
Engine Size (L)= 830.6" coords="84,107,71,130,66,156,69,182,80,206,99,226,122,238,148,243,174,239,198,227,217,209,229,185,233,159,150,159,84,107,"/>
<Area shape="poly" alt="Make=Toyota
Engine Size (L)=  75.1" title="Make=Toyota
Engine Size (L)=  75.1" coords="106,88,84,107,150,159,106,88,"/>
<Area shape="poly" alt="Make=Nissan
Engine Size (L)=  57.9" title="Make=Nissan
Engine Size (L)=  57.9" coords="126,79,106,88,150,159,126,79,"/>
<Area shape="poly" alt="Make=Mercedes-Benz
Engine Size (L)= 101.5" title="Make=Mercedes-Benz
Engine Size (L)= 101.5" coords="164,77,145,75,126,79,150,159,164,77,"/>
<Area shape="poly" alt="Make=Ford
Engine Size (L)=  81.7" title="Make=Ford
Engine Size (L)=  81.7" coords="194,88,164,77,150,159,194,88,"/>
<Area shape="poly" alt="Make=Chevrolet
Engine Size (L)= 100.8" title="Make=Chevrolet
Engine Size (L)= 100.8" coords="221,115,209,100,194,88,150,159,221,115,"/>
<Area shape="poly" alt="Make=BMW
Engine Size (L)=  62.5" title="Make=BMW
Engine Size (L)=  62.5" coords="230,137,221,115,150,159,230,137,"/>
<Area shape="poly" alt="Make=Audi
Engine Size (L)=  58.1" title="Make=Audi
Engine Size (L)=  58.1" coords="233,159,230,137,150,159,233,159,"/>
</map>
PROC Star
Posts: 1,329

Re: Save WEBOUT dataset used by PROC SGPLOT to create imagemap

Thanks for adding example.  I'm going to move this to the "SAS/GRAPH and ODS Graphics" community.  I think it should attract the right eyeballs there.

PROC Star
Posts: 1,329

Re: Save WEBOUT dataset used by PROC SGPLOT to create imagemap

I looked at the docs a bit, but can't see a way to get the imagemap as data.  Parsing the html might be the only way.  Unless one of the ODS graphics wizards has an idea.  @Sanjay_SAS @DanH_sas @Vince_SAS

SAS Super FREQ
Posts: 320

Re: Save WEBOUT dataset used by PROC SGPLOT to create imagemap

I think that the only way to do this is to write DATA step code to post-process the file to retrieve the information that you need.

 

Vince DelGobbo

SAS R&D

Ask a Question
Discussion stats
  • 5 replies
  • 180 views
  • 3 likes
  • 3 in conversation