BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
GeorgeT
Calcite | Level 5

I am using a stored process with streaming output on SAS9.4 M2 to generate a html page containing a chart.  I want to make the chart title clickable to enable a further stored process to be run and it's resulting html rendered.  To do this I have used an annotation dataset to add a link to the output of proc sgplot and positioned it at the tope where the chart title might normally be drawn.  The problem I have is that every time the link is clicked the results open in a new tab, whereas I want them to replace the page in my existing tab.  It seems to me that proc sgplot is adding target=_Blank to the link its generating and I want to use target=_self, is there a way to control this that I've missed? 

 

 

The stored process looks like so

 


*processbody;



%symdel _program;

 

%macro mplot_chart(lprefix=);

 

/*This chart annotation functions as a clickable link*/

data &lprefix._annotation;

length function $ 8 url $ 255 anchor $ 5;

 function="text";

 label="&lprefix Chart Title";

 url=cats("&_THISSESSION",'&_PROGRAM','=%2FMyMetadatafolder%2Fshowdetails&inprefix=',

"&lprefix");

 textstyleelement="GraphTitleText";

 textcolor="blue";

 width=100;

 anchor="top";

 y1=100;

 drawspace="GraphPercent";

 

output;

run;

 

/*Create the plot*/

proc sgplot data=save.&lprefix._plotdata

 sganno=&lprefix._annotation pad=(top=25px);

 

series x=utcdatetime y=var1;

series x=utcdatetime y=var2 / lineattrs=(color=red);

run;



%mend mplot_chart;

 

ods graphics on / imagemap=on;

ods graphics / width=3.5in height=2.5in;

ods layout gridded columns=4 advance=table;

title;

 

%mplot_chart(lprefix=Location1);

%mplot_chart(lprefix=Location2);



 

title;

ods layout end;

ods graphics / reset;

 

/*ods html text="</div>";*/

%stpend;


 

1 ACCEPTED SOLUTION

Accepted Solutions
Vince_SAS
Rhodochrosite | Level 12

This is an ODS Graphics issue, not a stored process issue.  You can reproduce the problem outside of a stored process by submitting this code:

 

 

The image map created looks like this:

 

data work.sgplot_anno;
function         = 'text';
label            = 'Chart Title';
url              = 'https://www.sas.com';
textstyleelement = 'GraphTitleText';
textcolor        = 'blue';
width            = 100;
anchor           = 'top';
y1               = 100;
drawspace        = 'GraphPercent';
run;

ods graphics on / imagemap=on drilltarget='_self';

ods graphics / width=3.5in height=2.5in;

title;

ods _all_ close;

ods html path='C:\temp' file='temp.htm' style=HTMLBlue;

proc sgplot data=sashelp.class sganno=work.sgplot_anno pad=(top=25px);
  vbar age;
run; quit;

ods html close;

 

<Area shape="poly" href="https://www.sas.com" target="_BLANK" coords="135.5,0.0,200.5,0.0,200.5,19.40625,135.5,19.40625,135.5,0.0,135.5,0.0"/>

 

The solution is to add the DRILLTARGET option to your ODS GRAPHICS statement:

 

ods graphics on / imagemap=on drilltarget='_self';

The image map created now looks like this:

 

<Area shape="poly" href="https://www.sas.com" target="_self" coords="135.5,0.0,200.5,0.0,200.5,19.40625,135.5,19.40625,135.5,0.0,135.5,0.0"/>

 

Vince DelGobbo

SAS R&D

View solution in original post

1 REPLY 1
Vince_SAS
Rhodochrosite | Level 12

This is an ODS Graphics issue, not a stored process issue.  You can reproduce the problem outside of a stored process by submitting this code:

 

 

The image map created looks like this:

 

data work.sgplot_anno;
function         = 'text';
label            = 'Chart Title';
url              = 'https://www.sas.com';
textstyleelement = 'GraphTitleText';
textcolor        = 'blue';
width            = 100;
anchor           = 'top';
y1               = 100;
drawspace        = 'GraphPercent';
run;

ods graphics on / imagemap=on drilltarget='_self';

ods graphics / width=3.5in height=2.5in;

title;

ods _all_ close;

ods html path='C:\temp' file='temp.htm' style=HTMLBlue;

proc sgplot data=sashelp.class sganno=work.sgplot_anno pad=(top=25px);
  vbar age;
run; quit;

ods html close;

 

<Area shape="poly" href="https://www.sas.com" target="_BLANK" coords="135.5,0.0,200.5,0.0,200.5,19.40625,135.5,19.40625,135.5,0.0,135.5,0.0"/>

 

The solution is to add the DRILLTARGET option to your ODS GRAPHICS statement:

 

ods graphics on / imagemap=on drilltarget='_self';

The image map created now looks like this:

 

<Area shape="poly" href="https://www.sas.com" target="_self" coords="135.5,0.0,200.5,0.0,200.5,19.40625,135.5,19.40625,135.5,0.0,135.5,0.0"/>

 

Vince DelGobbo

SAS R&D

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

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.

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
  • 1 reply
  • 728 views
  • 1 like
  • 2 in conversation