<?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: What is the best way to import XLSX files with many sheets? in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-best-way-to-import-XLSX-files-with-many-sheets/m-p/650654#M195130</link>
    <description>&lt;P&gt;I would start out with a list of Excel file names in a data set.&lt;/P&gt;
&lt;P&gt;Next, create a macro that&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;assigns a libname to an Excel file&lt;/LI&gt;
&lt;LI&gt;combines all datasets (sheets) to a single WORK dataset&lt;/LI&gt;
&lt;LI&gt;transposes this dataset to long format, BY the first three columns, deleting observations with missing values&lt;/LI&gt;
&lt;LI&gt;names the log dataset along the name of the excel file&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Run this macro repeatedly from the list of Excel file names with CALL EXECUTE.&lt;/P&gt;
&lt;P&gt;Finally, combine the resulting long datasets into one, with a SET statement reading all long datasets.&lt;/P&gt;</description>
    <pubDate>Tue, 26 May 2020 10:33:33 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-05-26T10:33:33Z</dc:date>
    <item>
      <title>What is the best way to import XLSX files with many sheets?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-best-way-to-import-XLSX-files-with-many-sheets/m-p/648358#M194188</link>
      <description>&lt;P&gt;I have two thousands of XLSX files. Each file has about 60 sheets. Each sheet contains some data as in the attached photo. What would be the best way to bulk import these files?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ducman1611_0-1589685884512.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/39533i07034898DFE681EC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ducman1611_0-1589685884512.png" alt="ducman1611_0-1589685884512.png" /&gt;&lt;/span&gt;&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>Sun, 17 May 2020 03:25:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-best-way-to-import-XLSX-files-with-many-sheets/m-p/648358#M194188</guid>
      <dc:creator>somebody</dc:creator>
      <dc:date>2020-05-17T03:25:55Z</dc:date>
    </item>
    <item>
      <title>Re: What is the best way to import XLSX files with many sheets?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-best-way-to-import-XLSX-files-with-many-sheets/m-p/648362#M194191</link>
      <description>&lt;P&gt;One of the best ways I can think of is to use a LIBNAME statement using the EXCEL engine to treat an Excel workbook like a SAS library. Then you can use PROC DATASETS to copy all sheets in a workbook in one statement:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;libname MyExcel EXCEL "MyExcelWorkbook.xlsx";

proc datasets library = WORK nolist;
  copy in = MyExcel out = WORK;
run;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Once you have got this working for one workbook, then you can consider automating this for say all workbooks in a directory. Eventually a SAS macro could be built to do this.&lt;/P&gt;</description>
      <pubDate>Sun, 17 May 2020 04:11:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-best-way-to-import-XLSX-files-with-many-sheets/m-p/648362#M194191</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2020-05-17T04:11:35Z</dc:date>
    </item>
    <item>
      <title>Re: What is the best way to import XLSX files with many sheets?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-best-way-to-import-XLSX-files-with-many-sheets/m-p/648367#M194193</link>
      <description>&lt;P&gt;Do all these sheets share the same structure? Anyway, since you will not want to deal with 120000 datasets, you will need the mechanism to combine all these datasets into one or a few. Given that you import directly from Excel, this will be the challenge.&lt;/P&gt;
&lt;P&gt;Since I also see that you have data (dates) in structure (column names), a transpose as part of the import process is also in order.&lt;/P&gt;</description>
      <pubDate>Sun, 17 May 2020 06:57:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-best-way-to-import-XLSX-files-with-many-sheets/m-p/648367#M194193</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-05-17T06:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: What is the best way to import XLSX files with many sheets?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-best-way-to-import-XLSX-files-with-many-sheets/m-p/648461#M194258</link>
      <description>&lt;P&gt;yes, all the sheets are in the same format: the first two columns contains stock identity, the third is type and then other columns would be dates.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 18 May 2020 01:04:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-best-way-to-import-XLSX-files-with-many-sheets/m-p/648461#M194258</guid>
      <dc:creator>somebody</dc:creator>
      <dc:date>2020-05-18T01:04:13Z</dc:date>
    </item>
    <item>
      <title>Re: What is the best way to import XLSX files with many sheets?</title>
      <link>https://communities.sas.com/t5/SAS-Programming/What-is-the-best-way-to-import-XLSX-files-with-many-sheets/m-p/650654#M195130</link>
      <description>&lt;P&gt;I would start out with a list of Excel file names in a data set.&lt;/P&gt;
&lt;P&gt;Next, create a macro that&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;assigns a libname to an Excel file&lt;/LI&gt;
&lt;LI&gt;combines all datasets (sheets) to a single WORK dataset&lt;/LI&gt;
&lt;LI&gt;transposes this dataset to long format, BY the first three columns, deleting observations with missing values&lt;/LI&gt;
&lt;LI&gt;names the log dataset along the name of the excel file&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;Run this macro repeatedly from the list of Excel file names with CALL EXECUTE.&lt;/P&gt;
&lt;P&gt;Finally, combine the resulting long datasets into one, with a SET statement reading all long datasets.&lt;/P&gt;</description>
      <pubDate>Tue, 26 May 2020 10:33:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/What-is-the-best-way-to-import-XLSX-files-with-many-sheets/m-p/650654#M195130</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-05-26T10:33:33Z</dc:date>
    </item>
  </channel>
</rss>

