<?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 Read Multiple Text Files with FIeld Names in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Read-Multiple-Text-Files-with-FIeld-Names/m-p/534573#M146704</link>
    <description>&lt;P&gt;Hi.&amp;nbsp; I am attempting to use the methods outlined in this blog post:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://blogs.sas.com/content/sasdummy/2018/10/09/read-multiple-text-files/" target="_blank" rel="noopener"&gt;https://blogs.sas.com/content/sasdummy/2018/10/09/read-multiple-text-files/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to import multiple text files from a folder using a wildcard.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Example Code from Blog Post Above -&lt;/P&gt;&lt;PRE class="sas"&gt;&lt;SPAN&gt;data&lt;/SPAN&gt; accel;
  &lt;SPAN&gt;infile&lt;/SPAN&gt; &lt;SPAN&gt;"/home/chris.hemedinger/tsv/*.tsv"&lt;/SPAN&gt; 
   dlm=&lt;SPAN&gt;'09'&lt;/SPAN&gt;&lt;SPAN&gt;x&lt;/SPAN&gt;;
  &lt;SPAN&gt;length&lt;/SPAN&gt; counter &lt;SPAN&gt;8&lt;/SPAN&gt; 
         timestamp &lt;SPAN&gt;8&lt;/SPAN&gt; 
         &lt;SPAN&gt;x&lt;/SPAN&gt; &lt;SPAN&gt;8&lt;/SPAN&gt; y &lt;SPAN&gt;8&lt;/SPAN&gt; z &lt;SPAN&gt;8&lt;/SPAN&gt; 
         &lt;SPAN&gt;filename&lt;/SPAN&gt; $ &lt;SPAN&gt;25&lt;/SPAN&gt;;
  &lt;SPAN&gt;input&lt;/SPAN&gt; counter timestamp &lt;SPAN&gt;x&lt;/SPAN&gt; y z &lt;SPAN&gt;filename&lt;/SPAN&gt;;
&lt;SPAN&gt;run&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, each of my&amp;nbsp;files&amp;nbsp;has field names in the first row&amp;nbsp;and it appears that including&amp;nbsp;the firstobs=2 option only applies to the first file contained in the folder.&amp;nbsp; As a result, SAS is attempting to read in the first row of all my datasets (minus the first dataset)&amp;nbsp;as data and I am getting a lot of messages in the log about invalid data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At this point, I have&amp;nbsp;included a conditional statement to later delete these unwanted rows.&amp;nbsp; This method works, but I was wondering if there is a better&amp;nbsp;method that communicates to SAS to skip the first row of every dataset it is attempting to read in. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 11 Feb 2019 19:07:07 GMT</pubDate>
    <dc:creator>bh11</dc:creator>
    <dc:date>2019-02-11T19:07:07Z</dc:date>
    <item>
      <title>Read Multiple Text Files with FIeld Names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-Multiple-Text-Files-with-FIeld-Names/m-p/534573#M146704</link>
      <description>&lt;P&gt;Hi.&amp;nbsp; I am attempting to use the methods outlined in this blog post:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://blogs.sas.com/content/sasdummy/2018/10/09/read-multiple-text-files/" target="_blank" rel="noopener"&gt;https://blogs.sas.com/content/sasdummy/2018/10/09/read-multiple-text-files/&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;to import multiple text files from a folder using a wildcard.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;- Example Code from Blog Post Above -&lt;/P&gt;&lt;PRE class="sas"&gt;&lt;SPAN&gt;data&lt;/SPAN&gt; accel;
  &lt;SPAN&gt;infile&lt;/SPAN&gt; &lt;SPAN&gt;"/home/chris.hemedinger/tsv/*.tsv"&lt;/SPAN&gt; 
   dlm=&lt;SPAN&gt;'09'&lt;/SPAN&gt;&lt;SPAN&gt;x&lt;/SPAN&gt;;
  &lt;SPAN&gt;length&lt;/SPAN&gt; counter &lt;SPAN&gt;8&lt;/SPAN&gt; 
         timestamp &lt;SPAN&gt;8&lt;/SPAN&gt; 
         &lt;SPAN&gt;x&lt;/SPAN&gt; &lt;SPAN&gt;8&lt;/SPAN&gt; y &lt;SPAN&gt;8&lt;/SPAN&gt; z &lt;SPAN&gt;8&lt;/SPAN&gt; 
         &lt;SPAN&gt;filename&lt;/SPAN&gt; $ &lt;SPAN&gt;25&lt;/SPAN&gt;;
  &lt;SPAN&gt;input&lt;/SPAN&gt; counter timestamp &lt;SPAN&gt;x&lt;/SPAN&gt; y z &lt;SPAN&gt;filename&lt;/SPAN&gt;;
&lt;SPAN&gt;run&lt;/SPAN&gt;;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, each of my&amp;nbsp;files&amp;nbsp;has field names in the first row&amp;nbsp;and it appears that including&amp;nbsp;the firstobs=2 option only applies to the first file contained in the folder.&amp;nbsp; As a result, SAS is attempting to read in the first row of all my datasets (minus the first dataset)&amp;nbsp;as data and I am getting a lot of messages in the log about invalid data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;At this point, I have&amp;nbsp;included a conditional statement to later delete these unwanted rows.&amp;nbsp; This method works, but I was wondering if there is a better&amp;nbsp;method that communicates to SAS to skip the first row of every dataset it is attempting to read in. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 11 Feb 2019 19:07:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-Multiple-Text-Files-with-FIeld-Names/m-p/534573#M146704</guid>
      <dc:creator>bh11</dc:creator>
      <dc:date>2019-02-11T19:07:07Z</dc:date>
    </item>
    <item>
      <title>Re: Read Multiple Text Files with FIeld Names</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Read-Multiple-Text-Files-with-FIeld-Names/m-p/534587#M146707</link>
      <description>You need to modify your INPUT statement slightly and you can use EOV/EOF (end of variable or end of file) to indicate the end of a file.  See this skeleton code here: &lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/How-do-I-write-a-macro-to-import-multiple-text-files-that-have/ta-p/223627" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/How-do-I-write-a-macro-to-import-multiple-text-files-that-have/ta-p/223627&lt;/A&gt;</description>
      <pubDate>Mon, 11 Feb 2019 19:26:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Read-Multiple-Text-Files-with-FIeld-Names/m-p/534587#M146707</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2019-02-11T19:26:00Z</dc:date>
    </item>
  </channel>
</rss>

