<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to generate a TOC-sheet when the rest of the sheets are generated automatically? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-generate-a-TOC-sheet-when-the-rest-of-the-sheets-are/m-p/885210#M349767</link>
    <description>&lt;P&gt;After a lengthy discussion with chatGPT, we arrived at the following solution which does seem to work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;ods excel file="[path]";

/* Create the Table of Contents (TOC) sheet using ODS EXCEL */
ods excel options(sheet_name="Table of Contents");
proc print data=toc noobs label;
   var tab_name tab_description;
run;

ods excel options(sheet_interval='bygroup' sheet_name="#byval(bladnamn)");


PROC REPORT data=export;
by bladnamn;
column Redovisningsgrupp bladnamn variabel_cat_varde alder_grupp (kon,(andel CI_lower CI_upper lillan));
/* define variabelnamn / order order=internal;*/
define Redovisningsgrupp / group order=data noprint;
define order / order order=internal noprint;
define variabel / order order=internal noprint;
define bladnamn / group order=data noprint;
define variabel_cat_varde / order=data group;
define alder_grupp / order=data group;
define andel / mean;
define CI_lower / mean;
define CI_upper / mean;
define lillan / mean;
DEFINE kon / ACROSS ORDER=INTERNAL; 

compute before Redovisningsgrupp /style={just=left};;
line Redovisningsgrupp $char200.;
endcomp;

run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 18 Jul 2023 06:45:29 GMT</pubDate>
    <dc:creator>Syntas_error</dc:creator>
    <dc:date>2023-07-18T06:45:29Z</dc:date>
    <item>
      <title>How to generate a TOC-sheet when the rest of the sheets are generated automatically?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-generate-a-TOC-sheet-when-the-rest-of-the-sheets-are/m-p/885040#M349687</link>
      <description>&lt;P&gt;I need to create a Table-of-contents-sheet with hyperlinks to the rest of my excel sheets. That part is doable I think, using this as a template:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.lexjansen.com/sesug/2022/SESUG2022_Paper_232_Final_PDF.pdf" target="_blank" rel="noopener"&gt;https://www.lexjansen.com/sesug/2022/SESUG2022_Paper_232_Final_PDF.pdf&lt;/A&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I can also see how we might generate the urls and the names for the links dynamically (we just perform a query with PROC SQL and select the distinct sheet names for the data set we're working with).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I can't wrap my head around is how I'm supposed to generate a TOC-sheet when the rest of my sheets are generated automatically (I'm talking about just the actual sheet now, not the text or the hyperlinks within it):&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;PRE&gt;&lt;CODE class=""&gt;ods excel file="[path]");
PROC REPORT data=export;
by bladnamn;
column Redovisningsgrupp bladnamn variabel_cat_varde alder_grupp (kon,(andel CI_lower CI_upper lillan));
/* define variabelnamn / order order=internal;*/
define Redovisningsgrupp / group order=data noprint;
define order / order order=internal noprint;
define variabel / order order=internal noprint;
define bladnamn / group order=data noprint;
define variabel_cat_varde / order=data group;
define alder_grupp / order=data group;
define andel / mean;
define CI_lower / mean;
define CI_upper / mean;
define lillan / mean;
DEFINE kon / ACROSS ORDER=INTERNAL;&amp;nbsp;

compute before Redovisningsgrupp /style={just=left};;
line Redovisningsgrupp $char200.;
endcomp;

run;

ods excel close;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;DIV&gt;How do I do that?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I know I can set options(Contents="yes") in the ods statement, but that won't really let me customize the text and in addition, adds unappealing subheadings to each line in the table of contents.&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 12:42:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-generate-a-TOC-sheet-when-the-rest-of-the-sheets-are/m-p/885040#M349687</guid>
      <dc:creator>Syntas_error</dc:creator>
      <dc:date>2023-07-17T12:42:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a TOC-sheet when the rest of the sheets are generated automatically?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-generate-a-TOC-sheet-when-the-rest-of-the-sheets-are/m-p/885065#M349694</link>
      <description>&lt;P&gt;I can't answer, but wanted to share that Bari Lawhorn, from SAS Tech Support, presented an EXCELLENT webinar for customizing ODS PDF TOC's for BASUG.&amp;nbsp; The recording is:&amp;nbsp;&lt;A href="https://www.basug.org/videos?wix-vod-video-id=a17c9abb623e4f64b2ef843b0589dad3&amp;amp;wix-vod-comp-id=comp-klv807gt" target="_blank"&gt;https://www.basug.org/videos?wix-vod-video-id=a17c9abb623e4f64b2ef843b0589dad3&amp;amp;wix-vod-comp-id=comp-klv807gt&lt;/A&gt;&amp;nbsp; .&amp;nbsp; Slides&amp;nbsp;&lt;A href="https://www.basug.org/_files/ugd/6fce8c_aba2be0893314fa3bb3ca2c22fc1fc90.pdf" target="_blank"&gt;https://www.basug.org/_files/ugd/6fce8c_aba2be0893314fa3bb3ca2c22fc1fc90.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;Paper:&amp;nbsp;&lt;A href="https://support.sas.com/resources/papers/proceedings11/252-2011.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings11/252-2011.pdf&lt;/A&gt;&amp;nbsp;.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's not explicitly about EXCEL, but I imagine many of the approaches she mentions would apply, and there are references at the end that mention other ODS destinations.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Jul 2023 13:24:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-generate-a-TOC-sheet-when-the-rest-of-the-sheets-are/m-p/885065#M349694</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2023-07-17T13:24:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to generate a TOC-sheet when the rest of the sheets are generated automatically?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-generate-a-TOC-sheet-when-the-rest-of-the-sheets-are/m-p/885210#M349767</link>
      <description>&lt;P&gt;After a lengthy discussion with chatGPT, we arrived at the following solution which does seem to work:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=""&gt;ods excel file="[path]";

/* Create the Table of Contents (TOC) sheet using ODS EXCEL */
ods excel options(sheet_name="Table of Contents");
proc print data=toc noobs label;
   var tab_name tab_description;
run;

ods excel options(sheet_interval='bygroup' sheet_name="#byval(bladnamn)");


PROC REPORT data=export;
by bladnamn;
column Redovisningsgrupp bladnamn variabel_cat_varde alder_grupp (kon,(andel CI_lower CI_upper lillan));
/* define variabelnamn / order order=internal;*/
define Redovisningsgrupp / group order=data noprint;
define order / order order=internal noprint;
define variabel / order order=internal noprint;
define bladnamn / group order=data noprint;
define variabel_cat_varde / order=data group;
define alder_grupp / order=data group;
define andel / mean;
define CI_lower / mean;
define CI_upper / mean;
define lillan / mean;
DEFINE kon / ACROSS ORDER=INTERNAL; 

compute before Redovisningsgrupp /style={just=left};;
line Redovisningsgrupp $char200.;
endcomp;

run;

&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 18 Jul 2023 06:45:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-generate-a-TOC-sheet-when-the-rest-of-the-sheets-are/m-p/885210#M349767</guid>
      <dc:creator>Syntas_error</dc:creator>
      <dc:date>2023-07-18T06:45:29Z</dc:date>
    </item>
  </channel>
</rss>

