BookmarkSubscribeRSS Feed
atnk
Fluorite | Level 6

Hi Everyone, the code below works but produces the following table of contents:

Data Sample

  • Testing Var

Data Sample

  • Testing Var2

I would like to produce the following table of contents:

Data Sample

  • Testing Var
  • Testing Var2

Let me know how to change the TOC. Thanks. 

 

%macro graph1(inds=, var=, vard=,);

ods graphics on;

ods tagsets.sasreport13 (ID=EGSR) gtitle;

title "Data Sample Graph";

ods proc label "Data Sample";

 

proc sgplot data=&inds description="&vard";

yaxis type=Time interval=month;

yaxis label='Complete' ;

series x=period_dt y=complete_pct / lineattrs=(color=red) legendlabel='Count';

run; 

ods graphics off;

 

%mend;

ods html path=&folder 

body='body1.html'

contents='contents1.html'

frame='main1.html';

 

%graph1(inds=workdata, var=var1, vard=Testing Var);

ods html close;

%graph1(inds=workdata, var=var2, vard=Testing Var2);

1 REPLY 1
Bari_sas
SAS Employee

I would suggest ODS and PROC DOCUMENT to get the Table of Contents you described. Here's sample code, a screen shot of my contents= file, and a link to a paper on the subject in case it's helpful:


ods html file="before.html" contents="beforec.html" path="c:\temp";

ods document name=TOCtest(write);
proc sgplot data=sashelp.class;
vbar age / response=height;
run;
quit;

proc sgpanel data=sashelp.class;
panelby age / novarname columns=1;
where age=15;
hbar height;
run;

ods html close;
ods document close;

/* adjust the default style to enhance the table of contents */
/* here we remove the roman numeral in front of the first node */
ods path (prepend) work.template(update);
proc template;
define style styles.test;
parent=styles.htmlblue;
style contentProcname from Indexprocname /
bullet=none;
end;
run;

ods listing;
proc document name=TOCtest;
list / levels=all;
run;
make \test;
dir \test#1;
setlabel \test#1 "First Node";
setlabel \SGPlot#1\SGPlot#1 "First Output";
setlabel \SGPanel#1\SGPanel#1 "Second Output";
copy \SGPlot#1\SGPlot#1 to ^;
copy \SGPanel#1\SGPanel#1 to ^;
ods listing close;

ods html file="after.html" contents="afterc.html" path="c:\temp" style=styles.test;
replay \test#1;
run;
ods html close;
quit;

Bari_sas_0-1709931534959.png


https://support.sas.com/resources/papers/proceedings11/252-2011.pdf

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

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
  • 578 views
  • 0 likes
  • 2 in conversation