<?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: Need to Import more than 3000 xlsx files in sas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Need-to-Import-more-than-3000-xlsx-files-in-sas/m-p/403464#M98047</link>
    <description>Depending on what you have to do with the data, be prepared to fix variable type and length. This can be done automatically if you have the metadata.</description>
    <pubDate>Thu, 12 Oct 2017 07:19:05 GMT</pubDate>
    <dc:creator>error_prone</dc:creator>
    <dc:date>2017-10-12T07:19:05Z</dc:date>
    <item>
      <title>Need to Import more than 3000 xlsx files in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-Import-more-than-3000-xlsx-files-in-sas/m-p/403451#M98045</link>
      <description>&lt;P&gt;Dear All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I have a more than 3000 xlsx&amp;nbsp;files, I need to import those files into SAS. Is there any way other than macro?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Like libname or SAS/Access Please help me out in this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;Anil&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 06:10:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-Import-more-than-3000-xlsx-files-in-sas/m-p/403451#M98045</guid>
      <dc:creator>anilgvdbm</dc:creator>
      <dc:date>2017-10-12T06:10:34Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Import more than 3000 xlsx files in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-Import-more-than-3000-xlsx-files-in-sas/m-p/403454#M98046</link>
      <description>&lt;P&gt;You need proc import for each sheet, or a libname for each xlsx and proc copy or similar to retrieve all sheets in each file.&lt;/P&gt;
&lt;P&gt;So you need to set up a procedure that retrieves the names of all data items and then runs the import/copy process for each. This will involve macro and advanced data step programming.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Don't you have another way of getting the data from the original sources?&lt;/P&gt;
&lt;P&gt;Or is that actually all data that exists purely in Excel?&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 06:22:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-Import-more-than-3000-xlsx-files-in-sas/m-p/403454#M98046</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2017-10-12T06:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Import more than 3000 xlsx files in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-Import-more-than-3000-xlsx-files-in-sas/m-p/403464#M98047</link>
      <description>Depending on what you have to do with the data, be prepared to fix variable type and length. This can be done automatically if you have the metadata.</description>
      <pubDate>Thu, 12 Oct 2017 07:19:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-Import-more-than-3000-xlsx-files-in-sas/m-p/403464#M98047</guid>
      <dc:creator>error_prone</dc:creator>
      <dc:date>2017-10-12T07:19:05Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Import more than 3000 xlsx files in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-Import-more-than-3000-xlsx-files-in-sas/m-p/403470#M98049</link>
      <description>&lt;P&gt;Have to agree with the other two posters.&amp;nbsp; Do you have any sort of specification, documentation, fixed structure, or any sort of control over the source data whatsoever?&amp;nbsp; If not then you have 3000 individual problems, and if you choose to use proc import then that can be exponentially larger.&amp;nbsp; Excel is a really poor data medium as it does not enforce any structure on the data, for instance you cell could contain text, numbers, formulas, missings, picture, wordart etc., the columns may have mixed formatting or special items etc.&amp;nbsp; Proc import is a guessing procedure and it does its best to guess what the data is.&amp;nbsp; Thus combining these two would generally result in a very poor dataset with need for more processing to get it into a usable structure.&amp;nbsp; WE can show you the logic for repeating an import, but that really is 0.001% of the problem you face here.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 08:23:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-Import-more-than-3000-xlsx-files-in-sas/m-p/403470#M98049</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-10-12T08:23:55Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Import more than 3000 xlsx files in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-Import-more-than-3000-xlsx-files-in-sas/m-p/403479#M98050</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;SPAN class="UserName lia-user-name lia-user-rank-Super-User"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="login-bold"&gt;&lt;A id="link_8" class="lia-link-navigation lia-page-link lia-user-name-link" href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562" target="_self"&gt;KurtBremse&lt;/A&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Super-User"&gt;&lt;SPAN class="login-bold"&gt;These 3000 files are having same variable names. the data is for the entire country level so these 3000 files are only for one year like this I have 3 years data. Each File having only &lt;STRONG&gt;one sheet data.&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Super-User"&gt;&lt;SPAN class="login-bold"&gt;So,&amp;nbsp;I cont write macro for around 10000 files so is there any other way to do it?\&lt;/SPAN&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;&lt;SPAN class="UserName lia-user-name lia-user-rank-Super-User"&gt;&lt;SPAN class="login-bold"&gt;Regards,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Super-User"&gt;&lt;SPAN class="login-bold"&gt;Anil&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 09:37:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-Import-more-than-3000-xlsx-files-in-sas/m-p/403479#M98050</guid>
      <dc:creator>anilgvdbm</dc:creator>
      <dc:date>2017-10-12T09:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Import more than 3000 xlsx files in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-Import-more-than-3000-xlsx-files-in-sas/m-p/403486#M98051</link>
      <description>&lt;P&gt;Do you have command line access?&amp;nbsp; If so;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;filename pipe tmp 'dir "c:\test\*.xlsx" /b';

data _null_;
  infile tmp dlm="¬";
  input;
  call execute('proc import datafile="c:\test\'||strip(_infile_)||'" out=indata'||strip(put(_n_,best.))||'; run;');
run;
  &lt;/PRE&gt;
&lt;P&gt;What this does (and might be typos as not tested it) is get a list of filenames from command line, assuming your xlsx files are in c:\test, and for each of the filenames read, create a proc import statement to read the file out into a dataset called indata with a numeric suffix like, indata1 indata2 etc.&amp;nbsp; You could switch the language to libname.&amp;nbsp; You will still get mostly rubbish data you need to post-process however.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 10:32:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-Import-more-than-3000-xlsx-files-in-sas/m-p/403486#M98051</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-10-12T10:32:19Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Import more than 3000 xlsx files in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-Import-more-than-3000-xlsx-files-in-sas/m-p/403581#M98071</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/25743"&gt;@anilgvdbm&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi&amp;nbsp;&lt;SPAN class="UserName lia-user-name lia-user-rank-Super-User"&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="login-bold"&gt;&lt;A class="lia-link-navigation lia-page-link lia-user-name-link" id="link_8" href="https://communities.sas.com/t5/user/viewprofilepage/user-id/11562" target="_self"&gt;KurtBremse&lt;/A&gt;,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Super-User"&gt;&lt;SPAN class="login-bold"&gt;These 3000 files are having same variable names. the data is for the entire country level so these 3000 files are only for one year like this I have 3 years data. Each File having only &lt;STRONG&gt;one sheet data.&amp;nbsp;&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Super-User"&gt;&lt;SPAN class="login-bold"&gt;So,&amp;nbsp;I cont write macro for around 10000 files so is there any other way to do it?\&lt;/SPAN&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;&lt;SPAN class="UserName lia-user-name lia-user-rank-Super-User"&gt;&lt;SPAN class="login-bold"&gt;Regards,&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="UserName lia-user-name lia-user-rank-Super-User"&gt;&lt;SPAN class="login-bold"&gt;Anil&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Have you written a program to successfully bring one of the data sets into SAS? I would strongly suggest that Proc Import is not the way to go as you are almost certainly going to have issues with variable lengths and/or types that should remain constant as the proc will make guesses as to those items based on each individual file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would suggest that you use a libname approach such as&lt;/P&gt;
&lt;P&gt;libname inex EXCEL Path="&amp;lt;path to your folder&amp;gt;\onefile.xlsx";&lt;/P&gt;
&lt;P&gt;And see if you can read the data in excel that way into the form you need.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then expand that code either with a macro or call execute in a data step using the names or rules to build the names of the xlsx files in the libname statement.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 14:59:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-Import-more-than-3000-xlsx-files-in-sas/m-p/403581#M98071</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-10-12T14:59:44Z</dc:date>
    </item>
    <item>
      <title>Re: Need to Import more than 3000 xlsx files in sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Need-to-Import-more-than-3000-xlsx-files-in-sas/m-p/403587#M98072</link>
      <description>&lt;P&gt;You seem averse to using macros? Why?&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It’s the best method to import all at once. One other option, is to convert all to CSV - via a VBS script and then to import them all.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here’s an example of how this can work, with first finding all the names of files and then importing them all. You’ll want to design a process that will ensure the structure of the data is the same across all datasets and what you want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://github.com/statgeek/SAS-Tutorials/blob/master/Import_all_files_one_type" target="_blank"&gt;https://github.com/statgeek/SAS-Tutorials/blob/master/Import_all_files_one_type&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2017 15:07:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Need-to-Import-more-than-3000-xlsx-files-in-sas/m-p/403587#M98072</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-10-12T15:07:34Z</dc:date>
    </item>
  </channel>
</rss>

