<?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 import the external data (multiple delimeter file) into SAS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-external-data-multiple-delimeter-file-into-SAS/m-p/550274#M152761</link>
    <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/247664"&gt;@vThanu&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;If I have a multiple files with difference extension and I want to read all the files into SAS at once... how I have to do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for example in a specified location I have multiple file like&amp;nbsp; 2 excel (.xls) 1 CSV(.csv) , 1 text (.txt)&amp;nbsp; &amp;amp;&amp;nbsp; 1 Access (.mdb) files.&lt;/P&gt;
&lt;P&gt;I have to read all these file into sas with single step...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You can't import them all in one step. I suppose you could write a data step to generate the code to import all if you wanted to count that as one step, using call execute but that seems pointless.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;

call execute("proc import out=want1 datafile='/folders/myfolders/demo.csv' dmbs=csv replace; run;");

call execute("proc import out=want2 datafile='/folders/myfolders/demo2.csv' dmbs=csv replace; run;");

....

....

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 11 Apr 2019 15:12:42 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2019-04-11T15:12:42Z</dc:date>
    <item>
      <title>How to import the external data (multiple delimeter file) into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-external-data-multiple-delimeter-file-into-SAS/m-p/550259#M152760</link>
      <description>&lt;P&gt;If I have a multiple files with difference extension and I want to read all the files into SAS at once... how I have to do?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;for example in a specified location I have multiple file like&amp;nbsp; 2 excel (.xls) 1 CSV(.csv) , 1 text (.txt)&amp;nbsp; &amp;amp;&amp;nbsp; 1 Access (.mdb) files.&lt;/P&gt;&lt;P&gt;I have to read all these file into sas with single step...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 14:48:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-external-data-multiple-delimeter-file-into-SAS/m-p/550259#M152760</guid>
      <dc:creator>vThanu</dc:creator>
      <dc:date>2019-04-11T14:48:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the external data (multiple delimeter file) into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-external-data-multiple-delimeter-file-into-SAS/m-p/550274#M152761</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/247664"&gt;@vThanu&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;If I have a multiple files with difference extension and I want to read all the files into SAS at once... how I have to do?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;for example in a specified location I have multiple file like&amp;nbsp; 2 excel (.xls) 1 CSV(.csv) , 1 text (.txt)&amp;nbsp; &amp;amp;&amp;nbsp; 1 Access (.mdb) files.&lt;/P&gt;
&lt;P&gt;I have to read all these file into sas with single step...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;You can't import them all in one step. I suppose you could write a data step to generate the code to import all if you wanted to count that as one step, using call execute but that seems pointless.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;

call execute("proc import out=want1 datafile='/folders/myfolders/demo.csv' dmbs=csv replace; run;");

call execute("proc import out=want2 datafile='/folders/myfolders/demo2.csv' dmbs=csv replace; run;");

....

....

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Apr 2019 15:12:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-external-data-multiple-delimeter-file-into-SAS/m-p/550274#M152761</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-04-11T15:12:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the external data (multiple delimeter file) into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-external-data-multiple-delimeter-file-into-SAS/m-p/550280#M152764</link>
      <description>&lt;P&gt;For each file you need a&amp;nbsp; specific filename:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename file1 excel "&amp;lt;path and file-1 name.xls&amp;gt;";
filename file2 excel "&amp;lt;path and file-2 name.xls&amp;gt;";
filename file3 "&amp;lt;path and file-3 name.txt&amp;gt;" dlm="&amp;lt;delimiters&amp;gt;";
filename file4 "&amp;lt;path and file-4 name.csv&amp;gt;" dlm=",";
/* and so on */

data want;
   infile file1 truncover end=eof1;;
   input &amp;lt;variables with their informats&amp;gt;;
   
   if eof1 then do;
      infile file2 truncover end=eof2;
      input &amp;lt;variables with their informats&amp;gt;;
   end;

   if eof2 then do;
      infile file3 truncover end=eof3;
      input &amp;lt;variables with their informats&amp;gt;;
   end;

  ...... etc. ......

run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 11 Apr 2019 15:18:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-external-data-multiple-delimeter-file-into-SAS/m-p/550280#M152764</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2019-04-11T15:18:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the external data (multiple delimeter file) into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-external-data-multiple-delimeter-file-into-SAS/m-p/550283#M152765</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/247664"&gt;@vThanu&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have to read all these file into sas with single step...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Why?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 15:21:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-external-data-multiple-delimeter-file-into-SAS/m-p/550283#M152765</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-11T15:21:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the external data (multiple delimeter file) into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-external-data-multiple-delimeter-file-into-SAS/m-p/550288#M152766</link>
      <description>to read the data for preparing intermediate data set and for analysis</description>
      <pubDate>Thu, 11 Apr 2019 15:32:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-external-data-multiple-delimeter-file-into-SAS/m-p/550288#M152766</guid>
      <dc:creator>vThanu</dc:creator>
      <dc:date>2019-04-11T15:32:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the external data (multiple delimeter file) into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-external-data-multiple-delimeter-file-into-SAS/m-p/550295#M152770</link>
      <description>Using Call execute here we are invoking each file every time.... if we have more files those many times invoking is time taken process and for each extensionn we are invoking.... any other way</description>
      <pubDate>Thu, 11 Apr 2019 15:36:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-external-data-multiple-delimeter-file-into-SAS/m-p/550295#M152770</guid>
      <dc:creator>vThanu</dc:creator>
      <dc:date>2019-04-11T15:36:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the external data (multiple delimeter file) into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-external-data-multiple-delimeter-file-into-SAS/m-p/550301#M152774</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/247664"&gt;@vThanu&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;to read the data for preparing intermediate data set and for analysis&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;That does not require "reading in on step". You can read each file independently&amp;nbsp; and then combine the data afterwards. Though you do want to make sure that the variable types and lengths are the same for commonly named variables across the sets.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would tend to guess that different file formats means the content varies a little between the files and it is likely easier to adjust several hopefully simple data steps reading each file than to try to write one very likely to be extremely complicated data step.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 15:48:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-external-data-multiple-delimeter-file-into-SAS/m-p/550301#M152774</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2019-04-11T15:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to import the external data (multiple delimeter file) into SAS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-external-data-multiple-delimeter-file-into-SAS/m-p/550377#M152810</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/247664"&gt;@vThanu&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;Using Call execute here we are invoking each file every time.... if we have more files those many times invoking is time taken process and for each extensionn we are invoking.... any other way&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;None that I'm aware of from any tool that I work with, which includes Python, R, or SAS.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the files are structured exactly the same each time and there's a defined ETL process, you could streamline it for each type of files but not different types because they have to be handled differently. Reading all CSVs into a single file is easy - I have an example of that in the Library section of this website.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Excel is a pain because it doesn't enforce types so you will have to verify these files for each one to ensure you have the correct types needed.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;MS Access is clean and easier because it enforces types, but each DB would need to be done separately as well.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Is this a one time process? Are you using SAS DI?&lt;/P&gt;
&lt;P&gt;How different are the files? Why can't you import one at a time.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can streamline the process for sure, having a process to scan the folder, find all the different file types and import each file type and save it within a single program. But not a single procedure.&amp;nbsp;&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;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2019 19:25:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-import-the-external-data-multiple-delimeter-file-into-SAS/m-p/550377#M152810</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-04-11T19:25:11Z</dc:date>
    </item>
  </channel>
</rss>

