<?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: Reading multiple text files without specifying the headers in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-text-files-without-specifying-the-headers/m-p/664276#M198415</link>
    <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I dont need it to be appended. I just need to append&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;To append or not to append, that seems to be the question ...&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Jun 2020 13:30:30 GMT</pubDate>
    <dc:creator>Kurt_Bremser</dc:creator>
    <dc:date>2020-06-23T13:30:30Z</dc:date>
    <item>
      <title>Reading multiple text files without specifying the headers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-text-files-without-specifying-the-headers/m-p/664128#M198371</link>
      <description>&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to import multiple text files with .txt extension. The sample looks like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;File1.txt&lt;/P&gt;&lt;P&gt;One Two Three Four Five&lt;/P&gt;&lt;P&gt;1 2 3 4 5&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;File2.txt&lt;/P&gt;&lt;P&gt;One Two Three Four Five Six Seven&lt;/P&gt;&lt;P&gt;1 2 3 4 5 6 7&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;File3.txt&lt;/P&gt;&lt;P&gt;One Mode Two File Three Extension Four Five Six Seven&lt;/P&gt;&lt;P&gt;1 SAS 2 F 3 txt 4 5 6 7&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So, all these three files have separate headers. Some of the headers are common but some are different.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to import all these files with headers. I dont need it to be appended. I just need to append these three datasets with the headers which are not common. Also, in this case I dont want to specify the header names as input everytime. In the real file, I have almost 150 variables which makes it difficult to specify the variable names under input.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Chandan mishra&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jun 2020 03:40:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-text-files-without-specifying-the-headers/m-p/664128#M198371</guid>
      <dc:creator>chandan_mishra</dc:creator>
      <dc:date>2020-06-23T03:40:23Z</dc:date>
    </item>
    <item>
      <title>Re: Reading multiple text files without specifying the headers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-text-files-without-specifying-the-headers/m-p/664136#M198375</link>
      <description>&lt;P&gt;Is the header, i.e. the variable names, part of the text file and is it always the first row?&lt;/P&gt;
&lt;P&gt;Is the delimiter between the variables (either the header or the values) is a space or other character?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jun 2020 04:59:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-text-files-without-specifying-the-headers/m-p/664136#M198375</guid>
      <dc:creator>Shmuel</dc:creator>
      <dc:date>2020-06-23T04:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: Reading multiple text files without specifying the headers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-text-files-without-specifying-the-headers/m-p/664137#M198376</link>
      <description>&lt;P&gt;So you have a big pile of data that does not fit together, but want to fit it together in a simple way? Forget it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In order to append at least the common variables into a final dataset, you have to make sure that the attributes of those variables fit. That is only possible by writing each data step yourself, proc import won't do.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jun 2020 05:04:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-text-files-without-specifying-the-headers/m-p/664137#M198376</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-23T05:04:18Z</dc:date>
    </item>
    <item>
      <title>Re: Reading multiple text files without specifying the headers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-text-files-without-specifying-the-headers/m-p/664261#M198408</link>
      <description>Yes the first row is the header always and the txt file is tab delimited.</description>
      <pubDate>Tue, 23 Jun 2020 12:55:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-text-files-without-specifying-the-headers/m-p/664261#M198408</guid>
      <dc:creator>chandan_mishra</dc:creator>
      <dc:date>2020-06-23T12:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: Reading multiple text files without specifying the headers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-text-files-without-specifying-the-headers/m-p/664276#M198415</link>
      <description>&lt;BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;I dont need it to be appended. I just need to append&lt;/SPAN&gt;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;SPAN&gt;To append or not to append, that seems to be the question ...&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jun 2020 13:30:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-text-files-without-specifying-the-headers/m-p/664276#M198415</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-23T13:30:30Z</dc:date>
    </item>
    <item>
      <title>Re: Reading multiple text files without specifying the headers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-text-files-without-specifying-the-headers/m-p/664351#M198462</link>
      <description>Hello&lt;BR /&gt;&lt;BR /&gt;I don’t need to append the datasets. Just need to import all of them as separate datasets.&lt;BR /&gt;&lt;BR /&gt;Thanks&lt;BR /&gt;Chandan mishra</description>
      <pubDate>Tue, 23 Jun 2020 15:22:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-text-files-without-specifying-the-headers/m-p/664351#M198462</guid>
      <dc:creator>chandan_mishra</dc:creator>
      <dc:date>2020-06-23T15:22:18Z</dc:date>
    </item>
    <item>
      <title>Re: Reading multiple text files without specifying the headers</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-text-files-without-specifying-the-headers/m-p/664359#M198466</link>
      <description>&lt;P&gt;Run a proc import on one of your files:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc import
  datafile="your_complete_path"
  out=datasetname
  dbms=tab
  replace
;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;and see if it works as desired.&lt;/P&gt;
&lt;P&gt;Then, check if your filenames can be used as valid SAS dataset names. If yes, wrap the above code into a macro definition:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro import_one(fname);
proc import
  datafile="your_path/&amp;amp;fname..txt"
  out=yourlib.&amp;amp;fname.
  dbms=tab
  replace
;
run;
%mend;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;which you can then call from a dataset that contains your filenames. If you need help creating such a dataset automatically from the directory, ask.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jun 2020 15:33:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-multiple-text-files-without-specifying-the-headers/m-p/664359#M198466</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2020-06-23T15:33:24Z</dc:date>
    </item>
  </channel>
</rss>

