<?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: Stored process with multiple output modes (pdf, excel, html) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Stored-process-with-multiple-output-modes-pdf-excel-html/m-p/968048#M376495</link>
    <description>Thank you. I will read the paper.&lt;BR /&gt;</description>
    <pubDate>Tue, 03 Jun 2025 21:01:05 GMT</pubDate>
    <dc:creator>jlwatts</dc:creator>
    <dc:date>2025-06-03T21:01:05Z</dc:date>
    <item>
      <title>Stored process with multiple output modes (pdf, excel, html)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Stored-process-with-multiple-output-modes-pdf-excel-html/m-p/968045#M376493</link>
      <description>&lt;P&gt;We have some sas code that we %include into most of our stored processes so that users can select their preferred style of output.&amp;nbsp; It is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data _null_;&lt;BR /&gt;if upcase("&amp;amp;outtype") = "HTML" then call symput("odsdest","HTML");&lt;BR /&gt;if upcase("&amp;amp;outtype") = "PDF" then do;&lt;BR /&gt;options orientation=landscape; rc = stpsrv_header('Content-type','application/pdf');&lt;BR /&gt;rc = stpsrv_header('Content-disposition','attachment; filename=temp.pdf');&lt;BR /&gt;call symput("odsdest","PDF");&lt;BR /&gt;end;&lt;BR /&gt;if upcase("&amp;amp;outtype") = "EXCEL" then do;&lt;BR /&gt;rc = stpsrv_header('Content-type','application/vnd.ms-excel;');&lt;BR /&gt;rc = stpsrv_header('Content-disposition','attachment; filename=temp.xls');&lt;BR /&gt;call symput("odsdest","tagsets.excelxp");&lt;BR /&gt;end;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;%let _odsdest=&amp;amp;odsdest;&lt;/P&gt;&lt;P&gt;%global _ODSSTYLE;&lt;BR /&gt;%let _ODSSTYLE=Normal;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The HTML and PDF output is fine, as the PROC REPORT is output with the headers and footers.&amp;nbsp; But the excel version of the output is lacking the headers and footers.&amp;nbsp; There are two parts to the report with each part being written to a separate worksheet in the file.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Why are the headers/footers not being displaced in Excel?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I tried a different set of code that does not have&amp;nbsp; &lt;FONT color="#0000FF"&gt;&lt;EM&gt;call symput("odsdest","tagsets.excelxp");&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;That output puts the headers/footers, but it all appears on a single worksheet.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Suggestions?&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jun 2025 20:05:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Stored-process-with-multiple-output-modes-pdf-excel-html/m-p/968045#M376493</guid>
      <dc:creator>jlwatts</dc:creator>
      <dc:date>2025-06-03T20:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: Stored process with multiple output modes (pdf, excel, html)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Stored-process-with-multiple-output-modes-pdf-excel-html/m-p/968047#M376494</link>
      <description>&lt;P&gt;You haven't shown the code that generates the report.&amp;nbsp; I assume it's inside a %stpbegin&amp;nbsp; block?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you're using tagsets.excelxp the default is for titles and footnotes to go in the header/footer of the sheet.&amp;nbsp; Did you check there to see if they exist?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to see the titles/footnotes in a cell in the spreadsheet, you can use the&amp;nbsp;embedded_titles='yes' option. This is an option of tagsets.excelxp destination.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think the way to do this would be to add to your excel block to create a global macro variable _odsoptions&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;if upcase("&amp;amp;outtype") = "EXCEL" then do;
  rc = stpsrv_header('Content-type','application/vnd.ms-excel;');
  rc = stpsrv_header('Content-disposition','attachment; filename=temp.xls');
  call symput("odsdest","tagsets.excelxp");
  call symput("_odsoptions", "embedded_titles='yes' embedded_footers='yes'");  *new line;
end;

&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This paper from the great Cynthia Zender explains the use of the global macro vars _odsoptions, _odsdstyle, etc:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://www.lexjansen.com/nesug/nesug07/ap/ap22.pdf" target="_blank" rel="noopener"&gt;https://www.lexjansen.com/nesug/nesug07/ap/ap22.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That said, tagsets.excelxp is pretty much deprecated, SAS introduced ODS EXCEL destination which will write .xlsx files 10 (?) years ago.&amp;nbsp; You might want to switch to ODS EXCEL.&amp;nbsp; But the general issue will likely be the same, you'll need to tinker with destination-specific options to get what you want. For comparison of tagsets.excelxp and excel destination, see this paper by the great Chevell Parker:&lt;BR /&gt;&lt;A href="https://support.sas.com/resources/papers/proceedings16/SAS5642-2016.pdf" target="_blank"&gt;https://support.sas.com/resources/papers/proceedings16/SAS5642-2016.pdf&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;hope that helps&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Jun 2025 21:03:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Stored-process-with-multiple-output-modes-pdf-excel-html/m-p/968047#M376494</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2025-06-03T21:03:52Z</dc:date>
    </item>
    <item>
      <title>Re: Stored process with multiple output modes (pdf, excel, html)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Stored-process-with-multiple-output-modes-pdf-excel-html/m-p/968048#M376495</link>
      <description>Thank you. I will read the paper.&lt;BR /&gt;</description>
      <pubDate>Tue, 03 Jun 2025 21:01:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Stored-process-with-multiple-output-modes-pdf-excel-html/m-p/968048#M376495</guid>
      <dc:creator>jlwatts</dc:creator>
      <dc:date>2025-06-03T21:01:05Z</dc:date>
    </item>
  </channel>
</rss>

