Hi:
According to the HTML specification, if you have an <A> tag like this:
[pre]
<a name="section"></a>
[/pre]
Then you are defining a named attribute (in this case, section) and therefore, any reference to
filename.html#section would allow navigation directly to that named section, assuming that the browser was compliant with the HTML spec.
http://www.w3schools.com/html/html_links.asp
[quote from above page]
When the name attribute is used, the <a> element defines a named anchor inside a HTML document.
Named anchor are not displayed in any special way. They are invisible to the reader.
[endquote]
That is the HTML specification. ODS actually inserts name attributes into your ODS HTML output file. The default NAME= attribute starts with 'IDX' and looks like this:
[pre]
<a name="IDX"></a> (for the first output table)
<a name="IDX1"></a> (for the second output table)
<a name="IDX2"></a> (for the third output table)
[/pre]
.... and the numbering continues from there...
If you use the CONTENTS= and FRAME= options, then ODS builds an HTML FRAMESET file that uses the CONTENTS= file and the BODY= file to display inside an HTML frame. Even if you do NOT use CONTENTS= or FRAME=, ODS still inserts the IDX NAME= attributes into the file.
After you create your HTML file with ODS, you would have to look at the file with NOTEPAD to see the use of the NAME=IDX, NAME=IDX1, etc. For example, if I run this code:
[pre]
data numloc;
infile datalines;
input number location $;
return;
datalines;
1 a
2 b
3 c
;
run;
ods listing close;
** default named section #IDX, #IDX1, #IDX2;
ods html file='c:\temp\default.html' style=sasweb;
proc print data=numloc noobs;
by number;
var location;
run;
ods html close;
[/pre]
Then this is what I would see in NOTEPAD when I examine the HTML file:
(some HTML tags deleted to only show relevant sections):
[pre]
<a name="IDX"></a>
<div class="c Byline">number=1</div>
<th class="l Header" scope="col">location</th>
<td class="l Data">a</td>
<a name="IDX1"></a>
<div class="c Byline">number=2</div>
<th class="l Header" scope="col">location</th>
<td class="l Data">b</td>
<a name="IDX2"></a>
<div class="c Byline">number=3</div>
<th class="l Header" scope="col">location</th>
<td class="l Data">c</td>
[/pre]
You can alter the string that is used for the NAME= attribute by using the ANCHOR= option in your ODS HTML invocation statement. To alter the string used for NAME=, you would submit an invocation statement something like one of these:
[pre]
ods html file='c:\temp\use_anchor_w.html' anchor='wombat'
style=sasweb;
ods html file='c:\temp\use_anchor.html' anchor='wombat10'
style=sasweb;
ods html file='c:\temp\use_anchor.html' anchor='1'
style=sasweb;
[/pre]
for the above invocations, the following NAME= sections would be created:
--ANCHOR='wombat' will make NAME= wombat, wombat1, wombat2
--ANCHOR='wombat10' will make NAME= wombat10, wombat11, wombat12
--ANCHOR='1' will make NAME= 1, 2, 3
Of course, now that the NAME= attributes are in the file, you will have to properly construct the HREF= attribute to link directly to that section. Again, looking to the W3C for guidance, the correct way to reference a NAME= section is not with a slash (/) in the HREF= attribute.
[quote from w3c site]
Example:
A named anchor inside an HTML document:
<a name="tips">Useful Tips Section</a>
A link to the Useful Tips Section from the same document:
<a href="#tips">Jump to the Useful Tips Section</a>
A link to the Useful Tips Section from another document:
<a href="http://www.w3schools.com/html_tutorial.htm#tips">
Jump to the Useful Tips Section</a>
[endquote]
Note that none of these examples contain a slash before the # reference to the NAME= section.
The insertion of a NAME= attribute is not related to any particular procedure -- it is part of how ODS constructs an HTML output file. Every output table created by your procedure will get a NAME= section. If your procedure creates 3 tables (which is what happens with the data you describe) then you would get three NAME= attributes. If your procedure of choice only creates 1 output table, then you would only get one NAME= attribute in the HTML file.
cynthia