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

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