BookmarkSubscribeRSS Feed
kurtyboy
Calcite | Level 5

We have a use case where we need to put an HTML ID tag on each element of a chart.  We do this with other SAS chart PROCs using GBARLINE, GCHART & GPLOT by inserting an HTML= option where the value of the HTML variable contains something like ID="xxxx".  Each and every element (point, bar, area) has it's own unique ID value.  We want the same ability with SGPLOT, but cannot find anywhere that this is possible.  We have tried the URL and TIP options, but these aren't meant to create an ID tag.  Here is an example of the SAS code (less the ODS HTML code and all of the non pertinent options) we use with GPLOT and the results it gives us:

 
...
DATA FINAL1;
SET FINAL;
FORMAT HTMLTXT $400.;
HTMLTXT = 'TITLE="simple hover detail"' ||
' ID="IDVAL' || COMPRESS(PUT(_N_,10.))|| '"';
RUN;

...

PROC GPLOT DATA=FINAL1 ;
PLOT yvalue * xvalue = varname/
...
HTML=HTMLTXT;
RUN;

...

 

One of the resulting lines of HTML code that is created should look like:

<area shape="RECT" TITLE="simple hover detail" ID="IDVAL1234" coords="890,449,898,454">

 

How can I do this with SGPLOT?

1 REPLY 1
Ksharp
Super User
You could simply overwrite HTML file generated by PROC SGPLOT to get ID tag.
It is very easy for SAS data step.

CFC_SAS_Communities_400x225.jpg

Call for content now open!

It's your turn to help shape SAS Innovate 2027. Share your expertise and inspire the SAS community.

Submit your proposal →

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
  • 1 reply
  • 127 views
  • 0 likes
  • 2 in conversation