<?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 delete sheet from excel using sas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-sheet-from-excel-using-sas/m-p/625281#M184287</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I've tried your code to delete a sheet from excel - it runs without errors, but the sheet is not deleted from the excel file. Any idea why?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Mon, 17 Feb 2020 14:42:31 GMT</pubDate>
    <dc:creator>LuciaCekanakova</dc:creator>
    <dc:date>2020-02-17T14:42:31Z</dc:date>
    <item>
      <title>How to delete sheet from excel using sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-sheet-from-excel-using-sas/m-p/581329#M165214</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i Want to delete excelsheet from excel using sas. Can I do that?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can i use DDE to delete sheet from excel using sas.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 01:27:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-sheet-from-excel-using-sas/m-p/581329#M165214</guid>
      <dc:creator>sam1231</dc:creator>
      <dc:date>2019-08-15T01:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete sheet from excel using sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-sheet-from-excel-using-sas/m-p/581330#M165215</link>
      <description>&lt;P&gt;Why not use PROC DATASETS? DDE only works if you are running SAS on your PC. PROC DATASETS works on both PCs and remote SAS servers.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname MyExcel EXCEL "MyExcelWorkbook.xlsx";

proc datasets library = MyExcel nolist nowarn;
  delete MySheetName;
  run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Aug 2019 01:40:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-sheet-from-excel-using-sas/m-p/581330#M165215</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-08-15T01:40:39Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete sheet from excel using sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-sheet-from-excel-using-sas/m-p/581349#M165223</link>
      <description>&lt;P&gt;thank you for your reply!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But it s give me below error.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ERROR: Connect: Class not registered ERROR: Error in the LIBNAME statement.&amp;nbsp;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;i am using below code:&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token statement"&gt;libname&lt;/SPAN&gt; MyExcel &lt;SPAN class="token keyword"&gt;EXCEL&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;"c/users/download/report.xlsx"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;

&lt;SPAN class="token procnames"&gt;proc&lt;/SPAN&gt; &lt;SPAN class="token procnames"&gt;datasets&lt;/SPAN&gt; library &lt;SPAN class="token operator"&gt;=&lt;/SPAN&gt; MyExcel nolist nowarn&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="token function"&gt;delete&lt;/SPAN&gt; MySheetName&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
  &lt;SPAN class="token procnames"&gt;run&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="token procnames"&gt;quit&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;I&amp;nbsp;have&amp;nbsp;PC&amp;nbsp;SERVER&amp;nbsp;FILE&amp;nbsp;installed.&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 15 Aug 2019 06:31:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-sheet-from-excel-using-sas/m-p/581349#M165223</guid>
      <dc:creator>sam1231</dc:creator>
      <dc:date>2019-08-15T06:31:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete sheet from excel using sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-sheet-from-excel-using-sas/m-p/581351#M165225</link>
      <description>&lt;P&gt;Please go through the instructions in this SAS note to diagnose this error then post your findings: &lt;A href="http://support.sas.com/kb/60/356.html" target="_blank"&gt;http://support.sas.com/kb/60/356.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Are you using local SAS on your PC? If so then you should refer to your spreadsheet like this:&lt;/P&gt;
&lt;PRE class="  language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token string"&gt;c:\users\download\report.xlsx&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 06:49:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-sheet-from-excel-using-sas/m-p/581351#M165225</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-08-15T06:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete sheet from excel using sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-sheet-from-excel-using-sas/m-p/581372#M165232</link>
      <description>&lt;P&gt;Try another engine.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class="  language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token statement"&gt;libname&lt;/SPAN&gt; MyExcel xlsx  &lt;SPAN class="token string"&gt;"c/users/download/report.xlsx"&lt;/SPAN&gt;&lt;SPAN class="token punctuation"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 12:01:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-sheet-from-excel-using-sas/m-p/581372#M165232</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-08-15T12:01:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete sheet from excel using sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-sheet-from-excel-using-sas/m-p/581418#M165249</link>
      <description>&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;This error happens when the bitness of SAS does not match the bitness of Microsoft Excel.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Try using the XLSX engine, like&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/18408"&gt;@Ksharp&lt;/a&gt;&amp;nbsp;suggested.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Vince DelGobbo&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;SAS R&amp;amp;D&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 15 Aug 2019 14:23:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-sheet-from-excel-using-sas/m-p/581418#M165249</guid>
      <dc:creator>Vince_SAS</dc:creator>
      <dc:date>2019-08-15T14:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete sheet from excel using sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-sheet-from-excel-using-sas/m-p/625281#M184287</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I've tried your code to delete a sheet from excel - it runs without errors, but the sheet is not deleted from the excel file. Any idea why?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2020 14:42:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-sheet-from-excel-using-sas/m-p/625281#M184287</guid>
      <dc:creator>LuciaCekanakova</dc:creator>
      <dc:date>2020-02-17T14:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete sheet from excel using sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-sheet-from-excel-using-sas/m-p/625287#M184289</link>
      <description>&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Can you post the exact code that you used, and the messages that you see in the log?&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Vince DelGobbo&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;SAS R&amp;amp;D&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2020 14:47:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-sheet-from-excel-using-sas/m-p/625287#M184289</guid>
      <dc:creator>Vince_SAS</dc:creator>
      <dc:date>2020-02-17T14:47:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete sheet from excel using sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-sheet-from-excel-using-sas/m-p/625298#M184294</link>
      <description>&lt;P&gt;My code:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname MyExcel EXCEL "C:\excel_file.xlsx";

proc datasets library = MyExcel nolist nowarn;
  delete Sheet5;
  run;
quit;

libname myexcel;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;And the whole log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Copyright (c) 2016 by SAS Institute Inc., Cary, NC, USA.&lt;BR /&gt;NOTE: SAS (r) Proprietary Software 9.4 (TS1M6 MBCS3170)&lt;BR /&gt;Licensed to SAS INTERNAL 940 19W04 WX6+ FULL PROD+GRID, Site 70146517.&lt;BR /&gt;NOTE: This session is executing on the X64_10PRO platform.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;NOTE: Analytical products:&lt;/P&gt;&lt;P&gt;SAS/STAT 15.1&lt;BR /&gt;SAS/ETS 15.1&lt;BR /&gt;SAS/OR 15.1&lt;BR /&gt;SAS/IML 15.1&lt;BR /&gt;SAS/QC 14.3&lt;/P&gt;&lt;P&gt;NOTE: Additional host information:&lt;/P&gt;&lt;P&gt;X64_10PRO WIN 10.0.16299 Workstation&lt;/P&gt;&lt;P&gt;NOTE: SAS initialization used:&lt;BR /&gt;real time 3.34 seconds&lt;BR /&gt;cpu time 2.84 seconds&lt;/P&gt;&lt;P&gt;NOTE: Unable to open SASUSER.REGSTRY. WORK.REGSTRY will be opened instead.&lt;BR /&gt;NOTE: All registry changes will be lost at the end of the session.&lt;BR /&gt;WARNING: Unable to copy SASUSER registry to WORK registry. Because of this,&lt;BR /&gt;WARNING: you will not see registry customizations during this session.&lt;BR /&gt;NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.&lt;BR /&gt;NOTE: All profile changes will be lost at the end of the session.&lt;BR /&gt;NOTE: This SAS session is using a registry in WORK. All changes will be lost at the end of&lt;BR /&gt;NOTE: this session.&lt;BR /&gt;NOTE: Unable to open SASUSER.PROFILE. WORK.PROFILE will be opened instead.&lt;BR /&gt;NOTE: All profile changes will be lost at the end of the session.&lt;/P&gt;&lt;P&gt;1 libname MyExcel EXCEL "C:\excel_file.xlsx";&lt;BR /&gt;NOTE: Libref MYEXCEL was successfully assigned as follows:&lt;BR /&gt;Engine: EXCEL&lt;BR /&gt;Physical Name: C:\excel_file.xlsx&lt;BR /&gt;2&lt;BR /&gt;3 proc datasets library = MyExcel nolist nowarn;&lt;BR /&gt;NOTE: Writing HTML Body file: sashtml.htm&lt;BR /&gt;4 delete Sheet5;&lt;BR /&gt;5 run;&lt;/P&gt;&lt;P&gt;6 quit;&lt;/P&gt;&lt;P&gt;NOTE: PROCEDURE DATASETS used (Total process time):&lt;BR /&gt;real time 1.05 seconds&lt;BR /&gt;cpu time 0.79 seconds&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;7&lt;BR /&gt;8 libname myexcel;&lt;BR /&gt;NOTE: Libref MYEXCEL has been deassigned.&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>Mon, 17 Feb 2020 15:10:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-sheet-from-excel-using-sas/m-p/625298#M184294</guid>
      <dc:creator>LuciaCekanakova</dc:creator>
      <dc:date>2020-02-17T15:10:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete sheet from excel using sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-sheet-from-excel-using-sas/m-p/625404#M184316</link>
      <description>&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Run this code and examine the output:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options validmemname=extend;&lt;BR /&gt;&lt;BR /&gt;libname MyExcel EXCEL 'C:\excel_file.xlsx';

proc contents data=MyExcel._all_; run; quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;The table name is MYEXCEL.'Sheet5$'n and &lt;STRONG&gt;'Sheet5$'n&lt;/STRONG&gt; is what you need to use in your code:&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;options validmemname=extend;&lt;BR /&gt;&lt;BR /&gt;libname MyExcel EXCEL 'C:\excel_file.xlsx';

proc datasets library = MyExcel nolist nowarn;
  delete 'Sheet5$'n;
run; quit;

libname MyExcel;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;The EXCEL engine deletes the contents of the worksheet, but does not remove the now empty worksheet from the file.&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;Vince DelGobbo&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT face="verdana,geneva"&gt;SAS R&amp;amp;D&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 17 Feb 2020 19:22:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-sheet-from-excel-using-sas/m-p/625404#M184316</guid>
      <dc:creator>Vince_SAS</dc:creator>
      <dc:date>2020-02-17T19:22:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete sheet from excel using sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-delete-sheet-from-excel-using-sas/m-p/625814#M184511</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;it works now, thank you!&lt;/P&gt;&lt;P&gt;Too bad it doesn't delete the sheet itself though.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Lucia&lt;/P&gt;</description>
      <pubDate>Wed, 19 Feb 2020 10:31:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-delete-sheet-from-excel-using-sas/m-p/625814#M184511</guid>
      <dc:creator>LuciaCekanakova</dc:creator>
      <dc:date>2020-02-19T10:31:03Z</dc:date>
    </item>
  </channel>
</rss>

