<?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: Can't access some members of an xlsx library in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Can-t-access-some-members-of-an-xlsx-library/m-p/611699#M178329</link>
    <description>&lt;P&gt;Problem is for sure in the tab names.&amp;nbsp; If I manually rename them in excel it is smooth sailing.&amp;nbsp; I'll give the xml method a go.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Elaine&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 13 Dec 2019 19:02:06 GMT</pubDate>
    <dc:creator>apprider</dc:creator>
    <dc:date>2019-12-13T19:02:06Z</dc:date>
    <item>
      <title>Can't access some members of an xlsx library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-access-some-members-of-an-xlsx-library/m-p/611600#M178278</link>
      <description>&lt;P&gt;I'm trying to get some excel data into SAS.&amp;nbsp; The workbooks contain an unpredictable number of sheets, and I am using the xlsx engine to try to access them.&amp;nbsp; I'm on 9.4 ts level 1m4 on x64eso8r2 platform.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My current data has 10 sheets in the workbook, 8 of them I can accesss without a problem, but 2 are an issue.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the code I am running:&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname multi clear;
libname multi XLSX 'H:\GCTT\site_tracker\multitab\Japan MDC_Study Tracker_20190820-2.xlsx';

%macro dummy;
proc sql;
 select count(distinct memname) into: ntables from sashelp.vtable where libname = 'MULTI';
 %let ntables = %sysfunc(compress(&amp;amp;ntables.));
  select distinct memname  from sashelp.vtable where libname = 'MULTI';

 select distinct memname into :table1-:table&amp;amp;ntables. from sashelp.vtable where libname = 'MULTI';
 run; quit;

 %do i =1 %to &amp;amp;ntables.;
    data work.t&amp;amp;i;
	  set MULTI."&amp;amp;&amp;amp;table&amp;amp;i"n;
	run;
  %end;
%mend dummy;
%dummy;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;the proc sql returns 10 members in the libname multi as expected:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 565px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/34754iAA6E5D0997307F3D/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;8 data sets are created without issue, but for the sheets Defintions_Recruitment Status and E708-C086-108 I get a the following error in the log:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;MLOGIC(DUMMY): %DO loop index variable I is now 7; loop will iterate again.&lt;BR /&gt;SYMBOLGEN: Macro variable I resolves to 7&lt;BR /&gt;MPRINT(DUMMY): data work.t7;&lt;BR /&gt;SYMBOLGEN: &amp;amp;&amp;amp; resolves to &amp;amp;.&lt;BR /&gt;SYMBOLGEN: Macro variable I resolves to 7&lt;BR /&gt;SYMBOLGEN: Macro variable TABLE7 resolves to E7080-C086-108&lt;BR /&gt;MPRINT(DUMMY): set MULTI."E7080-C086-108"n;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ERROR: Couldn't find range or sheet in spreadsheet&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ERROR: File MULTI.'E7080-C086-108'n.DATA does not exist.&lt;/FONT&gt;&lt;BR /&gt;MPRINT(DUMMY): run;&lt;/P&gt;&lt;P&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;WARNING: The data set WORK.T7 may be incomplete. When this step was stopped there were 0&lt;BR /&gt;observations and 0 variables.&lt;BR /&gt;WARNING: Data set WORK.T7 was not replaced because this step was stopped.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;real time 0.05 seconds&lt;BR /&gt;cpu time 0.04 seconds&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;MLOGIC(DUMMY): %DO loop index variable I is now 8; loop will iterate again.&lt;BR /&gt;SYMBOLGEN: Macro variable I resolves to 8&lt;BR /&gt;MPRINT(DUMMY): data work.t8;&lt;BR /&gt;SYMBOLGEN: &amp;amp;&amp;amp; resolves to &amp;amp;.&lt;BR /&gt;SYMBOLGEN: Macro variable I resolves to 8&lt;BR /&gt;SYMBOLGEN: Macro variable TABLE8 resolves to E7080-C086-308&lt;BR /&gt;MPRINT(DUMMY): set MULTI."E7080-C086-308"n;&lt;BR /&gt;MPRINT(DUMMY): run;&lt;/P&gt;&lt;P&gt;NOTE: The import data set has 24 observations and 12 variables.&lt;BR /&gt;NOTE: There were 24 observations read from the data set MULTI.'E7080-C086-308'n.&lt;BR /&gt;NOTE: The data set WORK.T8 has 24 observations and 12 variables.&lt;BR /&gt;NOTE: DATA statement used (Total process time):&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am stumped.&amp;nbsp; Any ideas on how to either correct this or a viable work around?&amp;nbsp;&amp;nbsp;I've tried a proc import with the same results, different access methods, etc.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Elaine&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 15:28:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-access-some-members-of-an-xlsx-library/m-p/611600#M178278</guid>
      <dc:creator>apprider</dc:creator>
      <dc:date>2019-12-13T15:28:13Z</dc:date>
    </item>
    <item>
      <title>Re: Can't access some members of an xlsx library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-access-some-members-of-an-xlsx-library/m-p/611604#M178280</link>
      <description>&lt;P&gt;You might have blanks or other invisible characters in the sheet names in the workbook.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 15:35:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-access-some-members-of-an-xlsx-library/m-p/611604#M178280</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-12-13T15:35:09Z</dc:date>
    </item>
    <item>
      <title>Re: Can't access some members of an xlsx library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-access-some-members-of-an-xlsx-library/m-p/611609#M178283</link>
      <description>&lt;P&gt;Some things to try.&lt;/P&gt;
&lt;P&gt;Dump the macro for now and try to get one of the problem sheets read using hardcoded names.&amp;nbsp; Does it help to use the old "'sheetname'$" syntax (or whatever it was) that worked with PROC IMPORT in the past for goofy sheetnames?&lt;/P&gt;
&lt;P&gt;Does it help to set VALIDMEMNAME option to EXTEND?&lt;/P&gt;
&lt;P&gt;Does PROC COPY find them?&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname multi XLSX 'H:\GCTT\site_tracker\multitab\Japan MDC_Study Tracker_20190820-2.xlsx';
proc copy inlib=multi out=work;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Can you get PROC IMPORT to read them?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 15:42:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-access-some-members-of-an-xlsx-library/m-p/611609#M178283</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-12-13T15:42:40Z</dc:date>
    </item>
    <item>
      <title>Re: Can't access some members of an xlsx library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-access-some-members-of-an-xlsx-library/m-p/611671#M178309</link>
      <description>&lt;P&gt;validmemname was set to extend, so that was not the problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Proc copy gave the same error on the two sheets, that they could not be found, plus had issue on writing out to datasets with dashes in the dataset names.&amp;nbsp; Proc contents listed all 10 datasets as member, but gave errors in the log for the two datasets that are problematic:&lt;/P&gt;&lt;P&gt;ERROR: Couldn't find range or sheet in spreadsheet&lt;BR /&gt;ERROR: File MULTI.'DEFINITIONS_RECRUITMENT STATUS'n.DATA does not exist.&lt;BR /&gt;ERROR: Couldn't find range or sheet in spreadsheet&lt;BR /&gt;ERROR: File MULTI.'E7080-C086-108'n.DATA does not exist.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Porc import failed as well:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;proc import datafile = "H:\GCTT\site_tracker\multitab\Japan MDC_Study&lt;BR /&gt;1377! Tracker_20190820-2.xlsx"&lt;BR /&gt;1378 dbms = xlsx&lt;BR /&gt;1379 out= work.try replace ;&lt;BR /&gt;1380 sheet = "DEFINITIONS_RECRUITMENT STATUS"n ;&lt;BR /&gt;1381 run;&lt;/P&gt;&lt;P&gt;ERROR: Couldn't find sheet in spreadsheet&lt;/P&gt;&lt;P&gt;NOTE: The SAS System stopped processing this step because of errors.&lt;BR /&gt;NOTE: PROCEDURE IMPORT used (Total process time):&lt;BR /&gt;real time 0.05 seconds&lt;BR /&gt;cpu time 0.00 seconds&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hate when excel is used as a data source, unfortunately I am not in a position to insist on a different format.&amp;nbsp;&amp;nbsp;&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;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 17:59:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-access-some-members-of-an-xlsx-library/m-p/611671#M178309</guid>
      <dc:creator>apprider</dc:creator>
      <dc:date>2019-12-13T17:59:20Z</dc:date>
    </item>
    <item>
      <title>Re: Can't access some members of an xlsx library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-access-some-members-of-an-xlsx-library/m-p/611672#M178310</link>
      <description>&lt;P&gt;Try using the $ trick:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;sheet = "'DEFINITIONS_RECRUITMENT STATUS$'"n ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;
&lt;P class="xisDoc-paragraph"&gt;&lt;SPAN class="xisDoc-nobr"&gt;SAS/ACCESS&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;treats an Excel workbook as a database and a worksheet or a range (subset of cells in a worksheet) as a table. A range name must be defined in the Excel file before SAS can use it. A worksheet is treated as a special range. A worksheet name appended with a $ character is treated as a range.&lt;/P&gt;
&lt;P class="xisDoc-paragraph"&gt;For example, Sheet1 is a sheet name in an Excel workbook. SAS treats Sheet1$ as a valid range name and uses it to refer to the whole worksheet. You need to use a SAS name literal when referring to the sheet name; for example, specify&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;CODE class="xisDoc-inlineCode"&gt;SHEET="'Sheet1$'n"&lt;/CODE&gt;, where the sheet name is enclosed in double quotation marks. The first row of data in a range is usually treated as a column heading and used to create a SAS variables name.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P class="xisDoc-paragraph"&gt;&lt;A href="https://documentation.sas.com/?docsetId=acpcref&amp;amp;docsetTarget=n0msy4hy1so0ren1acm90iijxn8j.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en"&gt;https://documentation.sas.com/?docsetId=acpcref&amp;amp;docsetTarget=n0msy4hy1so0ren1acm90iijxn8j.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en&lt;/A&gt;&lt;/P&gt;
&lt;P class="xisDoc-paragraph"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P class="xisDoc-paragraph"&gt;Other things to check is does the sheet name have a space? (is that possible in XLSX file?)&lt;/P&gt;
&lt;P class="xisDoc-paragraph"&gt;Also I see JAPAN in the path. Is it possible the sheet names are using non-7bit ASCII characters in their name? So what looks like a hyphen might actually be some type of en-dash or em-dash.&lt;/P&gt;
&lt;P class="xisDoc-paragraph"&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 18:07:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-access-some-members-of-an-xlsx-library/m-p/611672#M178310</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-12-13T18:07:38Z</dc:date>
    </item>
    <item>
      <title>Re: Can't access some members of an xlsx library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-access-some-members-of-an-xlsx-library/m-p/611679#M178317</link>
      <description>&lt;P&gt;Everything's possible in Excel. Including leading and trailing blanks in sheet names, I guess.&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 18:23:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-access-some-members-of-an-xlsx-library/m-p/611679#M178317</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-12-13T18:23:11Z</dc:date>
    </item>
    <item>
      <title>Re: Can't access some members of an xlsx library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-access-some-members-of-an-xlsx-library/m-p/611683#M178321</link>
      <description>&lt;P&gt;If you cannot get anything else to work you might look to write your own way to modify the sheet names. An XLSX file is just a ZIP file that contains a lot of XML files.&amp;nbsp; One of those XML files has the like of sheet names.&amp;nbsp; You could try copying the XLSX file and in the copy update that &lt;STRONG&gt;xl/workbook.xml&lt;/STRONG&gt; file so that the sheets have usable names.&lt;/P&gt;
&lt;P&gt;Here is example of the part of that file that has the sheet names.&lt;/P&gt;
&lt;PRE&gt;&amp;lt;sheets&amp;gt;
&amp;lt;sheet name="Sheet1" sheetId="1" r:id="rId1"/&amp;gt;
&amp;lt;sheet name="Sheet2" sheetId="2" r:id="rId2"/&amp;gt;
&amp;lt;sheet name="Sheet3" sheetId="3" r:id="rId3"/&amp;gt;
&amp;lt;/sheets&amp;gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 13 Dec 2019 18:36:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-access-some-members-of-an-xlsx-library/m-p/611683#M178321</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2019-12-13T18:36:24Z</dc:date>
    </item>
    <item>
      <title>Re: Can't access some members of an xlsx library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-access-some-members-of-an-xlsx-library/m-p/611699#M178329</link>
      <description>&lt;P&gt;Problem is for sure in the tab names.&amp;nbsp; If I manually rename them in excel it is smooth sailing.&amp;nbsp; I'll give the xml method a go.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Elaine&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Dec 2019 19:02:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-access-some-members-of-an-xlsx-library/m-p/611699#M178329</guid>
      <dc:creator>apprider</dc:creator>
      <dc:date>2019-12-13T19:02:06Z</dc:date>
    </item>
    <item>
      <title>Re: Can't access some members of an xlsx library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-access-some-members-of-an-xlsx-library/m-p/611795#M178401</link>
      <description>&lt;P&gt;Try this. what are you seeing .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;select distinct nliteral( memname ) from sashelp.vtable where libname = 'MULTI';&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 14 Dec 2019 12:26:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-access-some-members-of-an-xlsx-library/m-p/611795#M178401</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2019-12-14T12:26:43Z</dc:date>
    </item>
    <item>
      <title>Re: Can't access some members of an xlsx library</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Can-t-access-some-members-of-an-xlsx-library/m-p/702766#M215264</link>
      <description>&lt;P&gt;I meet similar problem while using&amp;nbsp;&lt;SPAN&gt;xlsx library. When there are tail blank in the sheetname, some error would occur.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;For example, there is a sheet named 'test 1 ' in file 'test.xlsx', and we use xlsx library to read this file:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname test xlsx '....../test.xlsx';&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;then SAS will treat the dataset as &lt;STRONG&gt;test.'test 1'n&lt;/STRONG&gt; rather than &lt;STRONG&gt;test.'test 1 'n&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#FF0000"&gt;ERROR: Couldn't find range or sheet in spreadsheet&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;ERROR: File MULTI.'E7080-C086-108'n.DATA does not exist.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Assume that the sheetname of table7 is '&lt;SPAN&gt;E7080-C086-108 ' rather than 'E7080-C086-108'.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Macro variable TABLE7 resolves to E7080-C086-108&lt;/STRONG&gt;, without the tail blank.&lt;/P&gt;&lt;P&gt;So File MULTI.'E7080-C086-108'n.DATA does not exist, however the correct file name is&amp;nbsp;MULTI.'E7080-C086-108 'n.DATA&lt;/P&gt;</description>
      <pubDate>Tue, 01 Dec 2020 09:35:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Can-t-access-some-members-of-an-xlsx-library/m-p/702766#M215264</guid>
      <dc:creator>meeeeeeeeo</dc:creator>
      <dc:date>2020-12-01T09:35:14Z</dc:date>
    </item>
  </channel>
</rss>

