<?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: libname excel - can we specify multiple ranges? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/libname-excel-can-we-specify-multiple-ranges/m-p/641585#M191236</link>
    <description>&lt;P&gt;The EXCEL engine is Windows-only, and uses the ACE supplied by Microsoft; it is not available on UE (runs on Linux), therefore I used XLSX, which I recommend for future use anyway (you need to have files in the modern XLSX format, of course).&lt;/P&gt;</description>
    <pubDate>Tue, 21 Apr 2020 12:17:59 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-04-21T12:17:59Z</dc:date>
    <item>
      <title>libname excel - can we specify multiple ranges?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/libname-excel-can-we-specify-multiple-ranges/m-p/641548#M191222</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let's work with an Excel file with 5 columns (A-E) where the first row contains the variable name.&lt;/P&gt;&lt;P&gt;We want to set together the first data row (line 2) and the five and sixth row (line 6-7) using the libname excel engine and a set statement in a dataset.&lt;/P&gt;&lt;P&gt;It won't be possible because the range has to include the variable name and a syntax like this &lt;CODE class=" language-sas"&gt;'SASHELP_CLASS$A1:E1;A6:E7'n&lt;/CODE&gt; would not work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Question: is it just not possible with libname engine+set statement or am I using the wrong syntax to define multiple ranges.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname demo excel "&amp;amp;demo./reporting/class.xlsx";

data demo.'SASHELP CLASS'n;
    set sashelp.class;
run;

libname demo;

libname demo excel "&amp;amp;demo./reporting/class.xlsx";

data test;  
    set demo.'SASHELP_CLASS$A1:E2'n
        demo.'SASHELP_CLASS$A1:E1;A6:E7'n;
run;

libname demo;

proc print data=test noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Apr 2020 09:25:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/libname-excel-can-we-specify-multiple-ranges/m-p/641548#M191222</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2020-04-21T09:25:48Z</dc:date>
    </item>
    <item>
      <title>Re: libname excel - can we specify multiple ranges?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/libname-excel-can-we-specify-multiple-ranges/m-p/641555#M191224</link>
      <description>&lt;P&gt;If you write a "dataset" with a blank in its name, you have to use that again when referring to it:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname demo xlsx "/folders/myfolders/class.xlsx";

data demo.'SASHELP CLASS'n;
set sashelp.class;
run;

data test;  
set
  demo.'SASHELP CLASS$A1:E2'n
  demo.'SASHELP CLASS$A1:E1;A6:E7'n
;

run;

proc print data=test noobs;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;This code worked in my SAS UE.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2020 09:39:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/libname-excel-can-we-specify-multiple-ranges/m-p/641555#M191224</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-21T09:39:13Z</dc:date>
    </item>
    <item>
      <title>Re: libname excel - can we specify multiple ranges?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/libname-excel-can-we-specify-multiple-ranges/m-p/641558#M191226</link>
      <description>&lt;P&gt;Thanks for the answer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Actually, I was using the underscore because it was present in my Excel file because I was using a Excel engine, not a xlsx engine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So basically the issue was not the syntax for the range&lt;/P&gt;&lt;P&gt;but the use of an Excel engine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;With excel engine, it does not work (not sure if it is a bug or just not implemented in the engine yet)&lt;/P&gt;&lt;P&gt;With xlsx engine, it works.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2020 09:49:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/libname-excel-can-we-specify-multiple-ranges/m-p/641558#M191226</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2020-04-21T09:49:19Z</dc:date>
    </item>
    <item>
      <title>Re: libname excel - can we specify multiple ranges?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/libname-excel-can-we-specify-multiple-ranges/m-p/641585#M191236</link>
      <description>&lt;P&gt;The EXCEL engine is Windows-only, and uses the ACE supplied by Microsoft; it is not available on UE (runs on Linux), therefore I used XLSX, which I recommend for future use anyway (you need to have files in the modern XLSX format, of course).&lt;/P&gt;</description>
      <pubDate>Tue, 21 Apr 2020 12:17:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/libname-excel-can-we-specify-multiple-ranges/m-p/641585#M191236</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-04-21T12:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: libname excel - can we specify multiple ranges?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/libname-excel-can-we-specify-multiple-ranges/m-p/641868#M191400</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;If the selection is working fine for distinct rows, it does seem to work for distinct columns.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;'SASHELP CLASS$A:C'n;&lt;/CODE&gt;&amp;nbsp; would select columns A, B and C which is ok.&lt;/P&gt;&lt;P&gt;&lt;CODE class=" language-sas"&gt;'SASHELP CLASS$A:A;C:C'n;&lt;/CODE&gt; would also select columsn A, B and C instead of A and C.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname demo xlsx "&amp;amp;demo./reporting/class.xlsx";

data test;  
   set demo.'SASHELP CLASS$A:A;C:C'n;
run;

libname demo;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Apr 2020 10:17:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/libname-excel-can-we-specify-multiple-ranges/m-p/641868#M191400</guid>
      <dc:creator>xxformat_com</dc:creator>
      <dc:date>2020-04-22T10:17:54Z</dc:date>
    </item>
  </channel>
</rss>

