<?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 Import multiple txt files into sas in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Import-multiple-txt-files-into-sas/m-p/21175#M3380</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank for clearing that up, i have tried the following&lt;/P&gt;&lt;P&gt; since i found some dataset with var names&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data sbpno.want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile 'datapath\*.txt';&lt;/P&gt;&lt;P&gt;&amp;nbsp; input AcNum&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Sum&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;D ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but it doesnt seem to capture the data containted in the files , any last guess or maybe i miss understood something from the above mentioned&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 30 Sep 2011 14:25:03 GMT</pubDate>
    <dc:creator>chemicalab</dc:creator>
    <dc:date>2011-09-30T14:25:03Z</dc:date>
    <item>
      <title>Import multiple txt files into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-multiple-txt-files-into-sas/m-p/21171#M3376</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Quite new to the macro world so here it goes,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a significant amount of txt files that i wish to upload into sas and then merge them . example of name of the files is as following:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;zomb_200911.txt&lt;/P&gt;&lt;P&gt;zomb_200912.txt&lt;/P&gt;&lt;P&gt;zomb_201001.txt&lt;/P&gt;&lt;P&gt;zomb_201002.txt&lt;/P&gt;&lt;P&gt;zomb_201003.txt and etc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;They all contain the same info, so i was wondering is there any simple macro i could apply for this situation?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thnx in advance&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Sep 2011 13:11:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-multiple-txt-files-into-sas/m-p/21171#M3376</guid>
      <dc:creator>chemicalab</dc:creator>
      <dc:date>2011-09-30T13:11:56Z</dc:date>
    </item>
    <item>
      <title>Import multiple txt files into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-multiple-txt-files-into-sas/m-p/21172#M3377</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If by "merge" you mean concatenate (i.e., create one file that includes the records from all of the other files) then you may only need something as simple as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile '*.txt';&lt;/P&gt;&lt;P&gt;&amp;nbsp; input yourvariable_list ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Sep 2011 13:17:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-multiple-txt-files-into-sas/m-p/21172#M3377</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-30T13:17:38Z</dc:date>
    </item>
    <item>
      <title>Import multiple txt files into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-multiple-txt-files-into-sas/m-p/21173#M3378</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes concatenate it is sorry, one last question, what if i not sure how many variables are contained in each txt file and i have no headers, how could i face that?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Sep 2011 13:29:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-multiple-txt-files-into-sas/m-p/21173#M3378</guid>
      <dc:creator>chemicalab</dc:creator>
      <dc:date>2011-09-30T13:29:37Z</dc:date>
    </item>
    <item>
      <title>Import multiple txt files into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-multiple-txt-files-into-sas/m-p/21174#M3379</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SAS has no way of guessing what your files contain.&amp;nbsp; For that, you either have to be able to recognize what the data represent or ask the person who created the file(s).&amp;nbsp; You could always bring one of the files up in a text editor (like notepad or wordpad) and see if you can recognize the key parameters, e.g., how many fields, how are they separated, are character fields enclosed in quotes, what each field represents, etc.).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then, you can use proc import to import one of the files and, after it has done so, press F3 to get SAS to spit back the actual code it wrote to import the file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From there, you should be well on your way to answering your own question.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Sep 2011 13:42:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-multiple-txt-files-into-sas/m-p/21174#M3379</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-30T13:42:08Z</dc:date>
    </item>
    <item>
      <title>Import multiple txt files into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-multiple-txt-files-into-sas/m-p/21175#M3380</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thank for clearing that up, i have tried the following&lt;/P&gt;&lt;P&gt; since i found some dataset with var names&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data sbpno.want;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile 'datapath\*.txt';&lt;/P&gt;&lt;P&gt;&amp;nbsp; input AcNum&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Sum&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;D ;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but it doesnt seem to capture the data containted in the files , any last guess or maybe i miss understood something from the above mentioned&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Sep 2011 14:25:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-multiple-txt-files-into-sas/m-p/21175#M3380</guid>
      <dc:creator>chemicalab</dc:creator>
      <dc:date>2011-09-30T14:25:03Z</dc:date>
    </item>
    <item>
      <title>Import multiple txt files into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-multiple-txt-files-into-sas/m-p/21176#M3381</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It would help if you could post one of the files or at least the first 10 records or so, as well as the messages you received in your log.&amp;nbsp; Like I mentioned, I would try to import one of the files using proc import and then seeing what code it wrote.&amp;nbsp; Chances are that you will have to include some informat and format lines so that SAS knows what kind of data it is reading.&amp;nbsp; But, even then, you would have to tell SAS what kind of file it is, i.e., delimited (and if so with what kind of delimiter).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will also probably have to input the files in two groups, one that has a header record and one that doesn't, and specify on which row the data actually start in each set.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 30 Sep 2011 14:33:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-multiple-txt-files-into-sas/m-p/21176#M3381</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-09-30T14:33:30Z</dc:date>
    </item>
    <item>
      <title>Import multiple txt files into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-multiple-txt-files-into-sas/m-p/21177#M3382</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just as Art said. For your situation , the best way is to use proc import, let SAS do it for you automatically.&lt;/P&gt;&lt;P&gt;But I recommend to use filename + pipe to get filename firstly ,then use macro to loop proc import .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ksharp&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 02 Oct 2011 09:20:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-multiple-txt-files-into-sas/m-p/21177#M3382</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2011-10-02T09:20:44Z</dc:date>
    </item>
    <item>
      <title>Import multiple txt files into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-multiple-txt-files-into-sas/m-p/21178#M3383</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you both for your answers , i will use the proc import to loop around&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thnx again&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Oct 2011 13:35:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-multiple-txt-files-into-sas/m-p/21178#M3383</guid>
      <dc:creator>chemicalab</dc:creator>
      <dc:date>2011-10-03T13:35:24Z</dc:date>
    </item>
    <item>
      <title>Import multiple txt files into sas</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-multiple-txt-files-into-sas/m-p/21179#M3384</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You never did post a couple of records from each of your two types of files (i.e., those that do and those that do not have header records).&amp;nbsp; It is quite possible to write code that can determine whether or not a header record exists and do all of the imports in one pass.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 03 Oct 2011 13:41:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-multiple-txt-files-into-sas/m-p/21179#M3384</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2011-10-03T13:41:24Z</dc:date>
    </item>
  </channel>
</rss>

