<?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 load data from multiple sheets of excel file using macro? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/how-to-load-data-from-multiple-sheets-of-excel-file-using-macro/m-p/353702#M273898</link>
    <description>&lt;P&gt;First rule of programming club, macro is&amp;nbsp;&lt;U&gt;&lt;STRONG&gt;never&lt;/STRONG&gt;&lt;/U&gt; needed. &amp;nbsp;What version of SAS/Excel are you using? &amp;nbsp;If your using 9.4 then the simplest way to do it is to use the libname excel method:&lt;/P&gt;
&lt;PRE&gt;libname myxlsx excel "&amp;lt;path to file&amp;gt;\&amp;lt;filename&amp;gt;.xlsx";

...

libname myxlsx clear;&lt;/PRE&gt;
&lt;P&gt;The libname excel will open an XLSX file, and create a dataset for each sheet it find which is compatible. &amp;nbsp;You can then use simple statements like:&lt;/P&gt;
&lt;PRE&gt;libname myxlsx excel "&amp;lt;path to file&amp;gt;\&amp;lt;filename&amp;gt;.xlsx";

data want;&lt;BR /&gt;  set myxlsx.'Sheet 1'n;&lt;BR /&gt;run;

libname myxlsx clear;&lt;/PRE&gt;</description>
    <pubDate>Wed, 26 Apr 2017 14:12:24 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2017-04-26T14:12:24Z</dc:date>
    <item>
      <title>how to load data from multiple sheets of excel file using macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-load-data-from-multiple-sheets-of-excel-file-using-macro/m-p/353695#M273897</link>
      <description>&lt;P&gt;Hi i have a excel file which has multiple sheets with name Jan, Feb, March, April, ....Dec. I want to load this data for further use using macro.&lt;/P&gt;&lt;P&gt;Thankyou&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 14:00:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-load-data-from-multiple-sheets-of-excel-file-using-macro/m-p/353695#M273897</guid>
      <dc:creator>ervinodsingh</dc:creator>
      <dc:date>2017-04-26T14:00:50Z</dc:date>
    </item>
    <item>
      <title>Re: how to load data from multiple sheets of excel file using macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-load-data-from-multiple-sheets-of-excel-file-using-macro/m-p/353702#M273898</link>
      <description>&lt;P&gt;First rule of programming club, macro is&amp;nbsp;&lt;U&gt;&lt;STRONG&gt;never&lt;/STRONG&gt;&lt;/U&gt; needed. &amp;nbsp;What version of SAS/Excel are you using? &amp;nbsp;If your using 9.4 then the simplest way to do it is to use the libname excel method:&lt;/P&gt;
&lt;PRE&gt;libname myxlsx excel "&amp;lt;path to file&amp;gt;\&amp;lt;filename&amp;gt;.xlsx";

...

libname myxlsx clear;&lt;/PRE&gt;
&lt;P&gt;The libname excel will open an XLSX file, and create a dataset for each sheet it find which is compatible. &amp;nbsp;You can then use simple statements like:&lt;/P&gt;
&lt;PRE&gt;libname myxlsx excel "&amp;lt;path to file&amp;gt;\&amp;lt;filename&amp;gt;.xlsx";

data want;&lt;BR /&gt;  set myxlsx.'Sheet 1'n;&lt;BR /&gt;run;

libname myxlsx clear;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Apr 2017 14:12:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-load-data-from-multiple-sheets-of-excel-file-using-macro/m-p/353702#M273898</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-04-26T14:12:24Z</dc:date>
    </item>
    <item>
      <title>Re: how to load data from multiple sheets of excel file using macro?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/how-to-load-data-from-multiple-sheets-of-excel-file-using-macro/m-p/353708#M273899</link>
      <description>&lt;P&gt;If you are using SAS 9.4 (since I think TSM2?) then just use the XLSX engine on a libname statement and you can treat the sheets as if they were datasets. &amp;nbsp;This does not require Excel and so works on Unix in addition to Windows, but I think it does require that you have SAS/Access to PC files licensed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I find it is useful to just use PROC COPY to copy all of the sheets into WORK datasets and then I can use them from there.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname in xlsx 'myfilename.xlsx';
proc copy inlib=in outlib=work;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 26 Apr 2017 14:25:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/how-to-load-data-from-multiple-sheets-of-excel-file-using-macro/m-p/353708#M273899</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2017-04-26T14:25:59Z</dc:date>
    </item>
  </channel>
</rss>

