BookmarkSubscribeRSS Feed
gzr2mz39
Quartz | Level 8
How do I modify this code so that the link opens in a new window?
I know that it involves target=_blank, but I'm not sure what the syntax is.

title1 link="www.sas.com" SAS;

Thank you.
3 REPLIES 3
Cynthia_sas
SAS Super FREQ
Hi:
You need to change the HREFTARGET style attribute, as described in this note:
http://support.sas.com/kb/23/437.html

The HREFTARGET attribute can be specified in a style template OR, in a TITLE statement, if you change the form of the link to be entirely specified with an ODS ESCAPECHAR style attribute override, you can do this:
[pre]
ods html file='c:\temp\uselink.html' style=sasweb;

ods escapechar='^';
title1 "^S={url='http://www.sas.com' hreftarget='_blank'} SAS";

proc print data=sashelp.class(obs=3);
run;

ods html close;
[/pre]

The only real difference is that instead of LINK= (which is a TITLE option), you are using URL= (which is a style attribute), but because you specify URL= in the ^S override, you can also specify HREFTARGET= within the same override.

ODS ESCAPECHAR must be set to the same character in the declaration statement as the character you use in the style override in the TITLE statement. For example, if you had:
[pre]
ODS ESCAPECHAR='~';

...then your TITLE statement would need to have the tilde (~) used:
title1 "~S={url='http://www.sas.com' hreftarget='_blank'} SAS";
[/pre]

This worked for me in SAS 9.2. For more information about ODS ESCAPECHAR capability, look in the ODS DOCUMENTATION or refer to these papers:
http://www2.sas.com/proceedings/forum2007/099-2007.pdf
http://www.nesug.org/Proceedings/nesug07/cc/cc18.pdf
http://www.nesug.org/proceedings/nesug08/np/np10.pdf
http://www2.sas.com/proceedings/sugi31/227-31.pdf
http://support.sas.com/resources/papers/sgf2008/odspdf.pdf

cynthia
gzr2mz39
Quartz | Level 8
This works:
ods escapechar='^';title1 "^S={url='http://www.sas.com' hreftarget='_blank'} SAS";

Which device is good to use with this (other than activex)?
I'm using ods tagsets.tableeditor and my output is html.
Thank you.
Cynthia_sas
SAS Super FREQ
Hi:
I'm not sure what you mean by "device". This title statement should work for any ODS output in a destination which supports styles and in a viewer that supports hyperlinks. So, for example, ODS HTML, ODS RTF and ODS PDF will all support the use of a URL or hyperlink in the title. However, ODS RTF, when opened in Microsoft Word will require that you CTRL+click the hyperlink to follow the link.

Generally, folks who use a "device" are using SAS/GRAPH device-based procedures (such as GCHART and GPLOT). The issue here is that ODS ESCAPECHAR is not used in SAS/GRAPH output. So, if the title you show is meant to go on a graph and the SAS/GRAPH device is in control of the title, then you can't use ODS ESCAPECHAR for that title.

Several ODS destinations (ODS HTML, ODS RTF) have the NOGTITLE, NOGFOOTNOTE options, which allow ODS to control the title (instead of SAS/GRAPH). If you use these options, then you could use ODS ESCAPECHAR in your SAS title and footnote. TAGSETS.TABLEEDITOR is an HTML-based destination. However, I do not know whether NOGTITLE and NOGFOOTNOTE are allowable options for TAGSETS.TABLEEDITOR when you use SAS/GRAPH. You would have to check the documentation or work with Tech Support on this question.

cynthia

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
  • 3 replies
  • 2116 views
  • 0 likes
  • 2 in conversation