<?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: Excel Sheet/Range Gotcha in Microsoft Integration with SAS</title>
    <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Excel-Sheet-Range-Gotcha/m-p/297903#M1893</link>
    <description>&lt;P&gt;That's right.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sheet names actually end with a $ sign in Excel too. They are just not shown to the user.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When SAS creates a data table in Excel with the Excel libname engine, it creates both a named range and a sheet.&lt;/P&gt;</description>
    <pubDate>Tue, 13 Sep 2016 03:36:31 GMT</pubDate>
    <dc:creator>PGStats</dc:creator>
    <dc:date>2016-09-13T03:36:31Z</dc:date>
    <item>
      <title>Excel Sheet/Range Gotcha</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Excel-Sheet-Range-Gotcha/m-p/297879#M1892</link>
      <description>&lt;P&gt;While attempting to read a worksheet from a workbook I couldn't read a&amp;nbsp;named range. &amp;nbsp;I used LIBNAME EXCEL to open the workbook and although I could see the sheets and ranges in the workbook in Excel, this one worksheet acted like it didn't exist&amp;nbsp;when viewed from SAS.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Took me a while to figure it out, the problem was with the naming of the sheet. &amp;nbsp;Excel has tab name length limit of 32 bytes, whereas SAS also will accept names up to 32 bytes. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem (bug?) is that for worksheets, SAS appends a dollar sign to the end. &amp;nbsp;Apparently, unlike Windows with its short filenames and long filenames, SAS doesn't have a way to rename a 32 byte worksheet name so it can add the '$' and remain 32 bytes or less.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Turns out an error message shows when you attempt to create a long-named sheet, but no error is given if you try to read one. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;libname exbk excel path="Test.xlsx";&lt;/P&gt;&lt;P&gt;/* fails */&lt;BR /&gt;DATA exbk.VeryLongFileName_ThirtyTwo_Bytes;&lt;BR /&gt;SET SASHelp.Class;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;/* works fine */&lt;BR /&gt;DATA exbk.NotSoLongFileName_26_Bytes;&lt;BR /&gt;SET SASHelp.Class;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;libname exbk clear;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the log:&lt;/P&gt;&lt;P&gt;1&lt;BR /&gt;2 libname exbk excel path="Test.xlsx";&lt;BR /&gt;NOTE: Libref EXBK was successfully assigned as follows:&lt;BR /&gt;Engine: EXCEL&lt;BR /&gt;Physical Name: C:\Users\pchoate\Desktop\Test.xlsx&lt;BR /&gt;3&lt;BR /&gt;4 DATA exbk.VeryLongFileName_ThirtyTwo_Bytes;&lt;BR /&gt;5 SET SASHelp.Class;&lt;BR /&gt;6 run;&lt;/P&gt;&lt;P&gt;ERROR: You may create a table with a name up to 31 chars long in Excel.&lt;BR /&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.05 seconds&lt;BR /&gt;cpu time 0.03 seconds&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;7&lt;BR /&gt;8 DATA exbk.NotSoLongFileName_26_Bytes;&lt;BR /&gt;9 SET SASHelp.Class;&lt;BR /&gt;10 run;&lt;/P&gt;&lt;P&gt;NOTE: There were 19 observations read from the data set SASHELP.CLASS.&lt;BR /&gt;NOTE: The data set EXBK.NotSoLongFileName_26_Bytes has 19 observations and 5 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.01 seconds&lt;BR /&gt;cpu time 0.01 seconds&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;11&lt;BR /&gt;12&lt;BR /&gt;13 libname exbk clear;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2016 00:09:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Excel-Sheet-Range-Gotcha/m-p/297879#M1892</guid>
      <dc:creator>PChoate</dc:creator>
      <dc:date>2016-09-13T00:09:38Z</dc:date>
    </item>
    <item>
      <title>Re: Excel Sheet/Range Gotcha</title>
      <link>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Excel-Sheet-Range-Gotcha/m-p/297903#M1893</link>
      <description>&lt;P&gt;That's right.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Sheet names actually end with a $ sign in Excel too. They are just not shown to the user.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When SAS creates a data table in Excel with the Excel libname engine, it creates both a named range and a sheet.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2016 03:36:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/Microsoft-Integration-with-SAS/Excel-Sheet-Range-Gotcha/m-p/297903#M1893</guid>
      <dc:creator>PGStats</dc:creator>
      <dc:date>2016-09-13T03:36:31Z</dc:date>
    </item>
  </channel>
</rss>

