<?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: Hide Excel Sheet after Export in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Hide-Excel-Sheet-after-Export/m-p/291832#M60480</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The simple answer is no. &amp;nbsp;SAS supports the import and export of data to and from Excel, it does not support specific Excel functions. &amp;nbsp;You could use DDE, however I would advise against using a very old unsupported technology. &amp;nbsp;Why do you want to export data to Excel but not show it, this doesn't make any sense? &amp;nbsp;Is it perhaps codelists or something similar - then look at the problem from the other end, build an Excel file which can read in CSV data, then your SAS program can just dump CSV data up for Excel to read on open. &amp;nbsp;Or the best solution in all these cases - stop using Excel. &amp;nbsp;Use a database, or reporting suite.&lt;/P&gt;</description>
    <pubDate>Tue, 16 Aug 2016 08:50:35 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2016-08-16T08:50:35Z</dc:date>
    <item>
      <title>Hide Excel Sheet after Export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hide-Excel-Sheet-after-Export/m-p/291763#M60453</link>
      <description>&lt;P&gt;Is there a non DDE option to hide an excel worksheet after data is exported to an excel file?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I am exporting data via proc append and despite my best efforts everytime I open the workbook after successfully exporting the data, the sheet I want to remain hidden is always visible. I've tried setting it to very hidden in the VBA editor but that doesnt work; when ever I export data to the file it unhides the sheet.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Any tips/suggestions are appreciated. Thanks.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 15 Aug 2016 19:45:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hide-Excel-Sheet-after-Export/m-p/291763#M60453</guid>
      <dc:creator>Ody</dc:creator>
      <dc:date>2016-08-15T19:45:30Z</dc:date>
    </item>
    <item>
      <title>Re: Hide Excel Sheet after Export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hide-Excel-Sheet-after-Export/m-p/291765#M60455</link>
      <description>&lt;P&gt;&lt;A href="http://stackoverflow.com/questions/19792154/export-formatted-excel-file-from-sas" target="_self"&gt;This Stack Overflow thread&lt;/A&gt; suggests using the following:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename sas2xls dde 'excel|system';
data _null_;
    file sas2xls;
    put '[open("C:\Users\Dmitry\Google Drive\SAS\test.xlsx")]';
    put '[workbook.hide("Sheet1")]';
    put '[error(false)]';
    put '[save()]';
    put '[file.close(false)]';
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 15 Aug 2016 20:02:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hide-Excel-Sheet-after-Export/m-p/291765#M60455</guid>
      <dc:creator>paulkaefer</dc:creator>
      <dc:date>2016-08-15T20:02:10Z</dc:date>
    </item>
    <item>
      <title>Re: Hide Excel Sheet after Export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hide-Excel-Sheet-after-Export/m-p/291832#M60480</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The simple answer is no. &amp;nbsp;SAS supports the import and export of data to and from Excel, it does not support specific Excel functions. &amp;nbsp;You could use DDE, however I would advise against using a very old unsupported technology. &amp;nbsp;Why do you want to export data to Excel but not show it, this doesn't make any sense? &amp;nbsp;Is it perhaps codelists or something similar - then look at the problem from the other end, build an Excel file which can read in CSV data, then your SAS program can just dump CSV data up for Excel to read on open. &amp;nbsp;Or the best solution in all these cases - stop using Excel. &amp;nbsp;Use a database, or reporting suite.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 08:50:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hide-Excel-Sheet-after-Export/m-p/291832#M60480</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2016-08-16T08:50:35Z</dc:date>
    </item>
    <item>
      <title>Re: Hide Excel Sheet after Export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hide-Excel-Sheet-after-Export/m-p/292027#M60543</link>
      <description>&lt;P&gt;From the perspective of using SAS only, these replies are what I guessed my options would be after researching this&amp;nbsp;for a few days; DDE or nothing.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for the input.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 23:57:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hide-Excel-Sheet-after-Export/m-p/292027#M60543</guid>
      <dc:creator>Ody</dc:creator>
      <dc:date>2016-08-16T23:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: Hide Excel Sheet after Export</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Hide-Excel-Sheet-after-Export/m-p/292577#M60760</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;SAS Forum: Hiding Rows in Excel or an entire sheet

XLConnect can hide a sheet in an existing work book
but it cannot hide the only sheet in a workbook.

HAVE ( Two sheets(males and females) in workbook 

Up to 40 obs from xls.males total obs=10

ROW    NAME       SEX    AGE    HEIGHT    WEIGHT

  1    Alfred      M      14     69.0      112.5
  2    Henry       M      14     63.5      102.5
  3    James       M      12     57.3       83.0
  4    Jeffrey     M      13     62.5       84.0
  5    John        M      12     59.0       99.5
  6    Philip      M      16     72.0      150.0
  7    Robert      M      12     64.8      128.0
  8    Ronald      M      15     67.0      133.0
  9    Thomas      M      11     57.5       85.0
 10    William     M      15     66.5      112.0

males|females


Up to 40 obs from xls.females total obs=9

ROW    NAME       SEX    AGE    HEIGHT    WEIGHT

  1    Alice       F      13     56.5       84.0
  2    Barbara     F      13     65.3       98.0
  3    Carol       F      14     62.8      102.5
  4    Jane        F      12     59.8       84.5
  5    Janet       F      15     62.5      112.5
  6    Joyce       F      11     51.3       50.5
  7    Judy        F      14     64.3       90.0
  8    Louise      F      12     56.3       77.0
  9    Mary        F      15     66.5      112.0

males/females


WANT to show only one sheet (hide the entire female sheet)

Up to 40 obs from xls.males total obs=10

ROW    NAME       SEX    AGE    HEIGHT    WEIGHT

  1    Alfred      M      14     69.0      112.5
  2    Henry       M      14     63.5      102.5
  3    James       M      12     57.3       83.0
  4    Jeffrey     M      13     62.5       84.0
  5    John        M      12     59.0       99.5
  6    Philip      M      16     72.0      150.0
  7    Robert      M      12     64.8      128.0
  8    Ronald      M      15     67.0      133.0
  9    Thomas      M      11     57.5       85.0
 10    William     M      15     66.5      112.0

males

SOLUTION

Here is the working part of the solution

%utl_submit_r64('
   library(XLConnect);
   wb &amp;lt;- loadWorkbook("d:/xls/hid.xlsx");
   hideSheet(wb,sheet="females");
   saveWorkbook(wb);
');

Again it takes more code to create the sample worksheets

%utlfkil(d:/xls/hid.xlsx);
libname xls "d:/xls/hid.xlsx";
data xls.males xls.females;
  set sashelp.class;
  if sex='M' then output xls.males;
  else output xls.females;
run;quit;
libname xls clear;


%utl_submit_r64('
   library(XLConnect);
   wb &amp;lt;- loadWorkbook("d:/xls/hid.xlsx");
   hideSheet(wb,sheet="females");
   saveWorkbook(wb);
');

Only this is visible

Up to 40 obs from xls.males total obs=10

ROW    NAME       SEX    AGE    HEIGHT    WEIGHT

  1    Alfred      M      14     69.0      112.5
  2    Henry       M      14     63.5      102.5
  3    James       M      12     57.3       83.0
  4    Jeffrey     M      13     62.5       84.0
  5    John        M      12     59.0       99.5
  6    Philip      M      16     72.0      150.0
  7    Robert      M      12     64.8      128.0
  8    Ronald      M      15     67.0      133.0
  9    Thomas      M      11     57.5       85.0
 10    William     M      15     66.5      112.0

males

As a side note you can hide rows with the amazing 'ODS EXCEL'
product.

* this hides all rows;
ods excel file="d:/xls/hidden.xlsx";
ods excel options(HIDDEN_ROWS='1-20');
ods excel options(sheet_name="sheet1" sheet_interval="none");
proc report data=sashelp.class;
run;quit;
ods excel close;


ODS excel is very powerfull
see
http://goo.gl/1A5rrp
http://support.sas.com/documentation/cdl/en/odsug/67921/HTML/default/viewer.htm#p09n5pw9ol0897n1qe04zeur27rv.htm


&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 18 Aug 2016 21:28:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Hide-Excel-Sheet-after-Export/m-p/292577#M60760</guid>
      <dc:creator>rogerjdeangelis</dc:creator>
      <dc:date>2016-08-18T21:28:27Z</dc:date>
    </item>
  </channel>
</rss>

