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

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 1 reply
  • 1358 views
  • 1 like
  • 2 in conversation