<?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: Import multiple excel files with same worksheets name into SAS in SAS Enterprise Guide</title>
    <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-excel-files-with-same-worksheets-name-into-SAS/m-p/699477#M37620</link>
    <description>&lt;P&gt;Do all sheets in all workbooks have similar variable names?&lt;/P&gt;</description>
    <pubDate>Tue, 17 Nov 2020 13:18:11 GMT</pubDate>
    <dc:creator>PeterClemmensen</dc:creator>
    <dc:date>2020-11-17T13:18:11Z</dc:date>
    <item>
      <title>Import multiple excel files with same worksheets name into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-excel-files-with-same-worksheets-name-into-SAS/m-p/699476#M37619</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;I have 300-400 excel files to import to SAS and create one single dataset. Each excel file has 6 data sheets. However all the sheet names and variable names in each sheet are same. Can you please help with the macro code? I am able to do single file?</description>
      <pubDate>Tue, 17 Nov 2020 13:16:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-excel-files-with-same-worksheets-name-into-SAS/m-p/699476#M37619</guid>
      <dc:creator>ranikeka</dc:creator>
      <dc:date>2020-11-17T13:16:06Z</dc:date>
    </item>
    <item>
      <title>Re: Import multiple excel files with same worksheets name into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-excel-files-with-same-worksheets-name-into-SAS/m-p/699477#M37620</link>
      <description>&lt;P&gt;Do all sheets in all workbooks have similar variable names?&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2020 13:18:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-excel-files-with-same-worksheets-name-into-SAS/m-p/699477#M37620</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2020-11-17T13:18:11Z</dc:date>
    </item>
    <item>
      <title>Re: Import multiple excel files with same worksheets name into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-excel-files-with-same-worksheets-name-into-SAS/m-p/699482#M37621</link>
      <description>Yes all files have same variable names and&lt;BR /&gt;also similar sheet names. Only the content is different.</description>
      <pubDate>Tue, 17 Nov 2020 13:31:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-excel-files-with-same-worksheets-name-into-SAS/m-p/699482#M37621</guid>
      <dc:creator>ranikeka</dc:creator>
      <dc:date>2020-11-17T13:31:08Z</dc:date>
    </item>
    <item>
      <title>Re: Import multiple excel files with same worksheets name into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-excel-files-with-same-worksheets-name-into-SAS/m-p/699494#M37622</link>
      <description>&lt;P&gt;Warning:&amp;nbsp; Using Excel files for data might lead to incompatible data types between files.&amp;nbsp; You will definitely see changes in the length of character variables based on what data appears in the individual file.&amp;nbsp; You might also get changes in the types of variables especially if the files are created by humans.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So are these XLSX files?&amp;nbsp; If so I would use the XLSX libname engine.&lt;/P&gt;
&lt;P&gt;So step one is get the list of XLSX files.&amp;nbsp; For example if your SAS session can run operating system commands you can read output of your operating systems directory command.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data files;
  infile 'ls /folder/*.xlsx' pipe truncover ;
  input filename $256. ;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Step two is to create a empty shells with the expected structure for the 6 sheets.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data sheet1;
  length A $20 B 8 C $25 ;
  stop;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Step three is use the list of files to generate code to append the data from the sheets.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename code temp;
data _null_;
  set files;
  file code;
  put 'libname xlsx xlsx ' filename :$quote. 'access=readonly;' ;
  put 'proc append data=xlsx.sheet1 base=sheet1; run';
  put 'proc append data=xlsx.sheet2 base=sheet2; run';
  put 'libname xlsx clear;';
run;
%include code / source2 ;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2020 13:58:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-excel-files-with-same-worksheets-name-into-SAS/m-p/699494#M37622</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2020-11-17T13:58:30Z</dc:date>
    </item>
    <item>
      <title>Re: Import multiple excel files with same worksheets name into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-excel-files-with-same-worksheets-name-into-SAS/m-p/699513#M37626</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;I am newbie in SAS and trying as much. can you please help in understating this code completely.I am using sas enterprise guide connecting with server. Thanks</description>
      <pubDate>Tue, 17 Nov 2020 14:34:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-excel-files-with-same-worksheets-name-into-SAS/m-p/699513#M37626</guid>
      <dc:creator>ranikeka</dc:creator>
      <dc:date>2020-11-17T14:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: Import multiple excel files with same worksheets name into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-excel-files-with-same-worksheets-name-into-SAS/m-p/699725#M37646</link>
      <description>Tom, although it's perfectly understood, is it possible that there's a typo in the third "put"?  Should be "sheet1" the base file?</description>
      <pubDate>Wed, 18 Nov 2020 10:00:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Enterprise-Guide/Import-multiple-excel-files-with-same-worksheets-name-into-SAS/m-p/699725#M37646</guid>
      <dc:creator>jarapoch</dc:creator>
      <dc:date>2020-11-18T10:00:29Z</dc:date>
    </item>
  </channel>
</rss>

