<?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: Importing Files with Similar Names in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Importing-Files-with-Similar-Names/m-p/469267#M120007</link>
    <description>&lt;P&gt;Well, it would be a more valid name.&amp;nbsp; However its more than that, one simple plain text file CSV would be far more usable for anything, e.g:&lt;/P&gt;
&lt;P&gt;Date,...&lt;/P&gt;
&lt;P&gt;201701,...&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;201702,...&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;Etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One file to read in, one program to read it all in in a consistent repeatable method.&amp;nbsp; One dataset to then use in your program.&amp;nbsp; File is portable across systems etc.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Jun 2018 14:52:21 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2018-06-11T14:52:21Z</dc:date>
    <item>
      <title>Importing Files with Similar Names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-Files-with-Similar-Names/m-p/469234#M119987</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have xlsx files with similar names that I want to import.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have files:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;201701 File.xlsx&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;201702 File.xlsx&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;201703 File.xlsx&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;201704 File.xlsx&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;201705 File.xlsx&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;...&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have proc import:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;proc import datafile='/XXXXX/201701 File.xlsx' out=File_201701;&lt;BR /&gt;dbms=xlsx replace;getnames=yes;datarow=3;&lt;BR /&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How I can import everything at once without manually having multiple proc import codes?&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 13:44:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-Files-with-Similar-Names/m-p/469234#M119987</guid>
      <dc:creator>kz134</dc:creator>
      <dc:date>2018-06-11T13:44:22Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Files with Similar Names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-Files-with-Similar-Names/m-p/469246#M119994</link>
      <description>&lt;P&gt;Depends what you know about the files, or if you have OS access or not.&lt;/P&gt;
&lt;PRE&gt;filename tmp pipe 'dir "c:/temp/*.xlsx" /b';

data _null_;
  infile tmp;
  input;
  ds_name=cats("_",scan(_input_,1," "));
  call execute(cat('proc import datafile="c:/temp/',_input_,'" out=',ds_name,' dbms=xlsx replace; getnames=yes; datarow=3; run;'));
run;&lt;/PRE&gt;
&lt;P&gt;Because your filenames start with a number you need to process it a bit to get a valid dataset name.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would really question why your getting data like this however, Excel is a really bad format, putting data in filenames is really bad practice.&amp;nbsp; Your just setting yourself up for a large amount of work.&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 14:02:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-Files-with-Similar-Names/m-p/469246#M119994</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-06-11T14:02:26Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Files with Similar Names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-Files-with-Similar-Names/m-p/469257#M120000</link>
      <description>&lt;P&gt;Thanks for your help! Would it be easier if I change the file names to File_201701 from 201701 File?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 14:20:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-Files-with-Similar-Names/m-p/469257#M120000</guid>
      <dc:creator>kz134</dc:creator>
      <dc:date>2018-06-11T14:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: Importing Files with Similar Names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Importing-Files-with-Similar-Names/m-p/469267#M120007</link>
      <description>&lt;P&gt;Well, it would be a more valid name.&amp;nbsp; However its more than that, one simple plain text file CSV would be far more usable for anything, e.g:&lt;/P&gt;
&lt;P&gt;Date,...&lt;/P&gt;
&lt;P&gt;201701,...&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;201702,...&lt;/P&gt;
&lt;P&gt;...&lt;/P&gt;
&lt;P&gt;Etc.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;One file to read in, one program to read it all in in a consistent repeatable method.&amp;nbsp; One dataset to then use in your program.&amp;nbsp; File is portable across systems etc.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jun 2018 14:52:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Importing-Files-with-Similar-Names/m-p/469267#M120007</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-06-11T14:52:21Z</dc:date>
    </item>
  </channel>
</rss>

