<?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 txt files with difference variable sequnce and concatenate into one file in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174849#M33558</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to import ~80 txt files (delimiter=tab) and concatenate them into one file, but don't know how to realized it as the raw data&lt;/P&gt;&lt;P&gt;1) first 3 rows are some useless header information, column name in row 4 and data start in row 5&lt;/P&gt;&lt;P&gt;2) txt file contains ~126 columns including character and numeric with different informat&lt;/P&gt;&lt;P&gt;3) some files have 126 columns, some have 128 columns (common 126+ extra 2)&lt;/P&gt;&lt;P&gt;4) Column sequnce in different txt file are different, column names are the same but some are uppercase while some lowercase&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone know how to efficiently get the result as import every file with correct column name and format, concatenate by column names （still keep the 2 extra columns) and get into one file?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 08 Jan 2015 14:07:56 GMT</pubDate>
    <dc:creator>Lin_Clare</dc:creator>
    <dc:date>2015-01-08T14:07:56Z</dc:date>
    <item>
      <title>Import txt files with difference variable sequnce and concatenate into one file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174849#M33558</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I need to import ~80 txt files (delimiter=tab) and concatenate them into one file, but don't know how to realized it as the raw data&lt;/P&gt;&lt;P&gt;1) first 3 rows are some useless header information, column name in row 4 and data start in row 5&lt;/P&gt;&lt;P&gt;2) txt file contains ~126 columns including character and numeric with different informat&lt;/P&gt;&lt;P&gt;3) some files have 126 columns, some have 128 columns (common 126+ extra 2)&lt;/P&gt;&lt;P&gt;4) Column sequnce in different txt file are different, column names are the same but some are uppercase while some lowercase&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone know how to efficiently get the result as import every file with correct column name and format, concatenate by column names （still keep the 2 extra columns) and get into one file?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 14:07:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174849#M33558</guid>
      <dc:creator>Lin_Clare</dc:creator>
      <dc:date>2015-01-08T14:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: Import txt files with difference variable sequnce and concatenate into one file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174850#M33559</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can definitiely design a MACRO definition to deal with the various file layouts but you will still need to use the basic INFILE/INPUT statement syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For instance you will want use the FIRSTOBS= data set option to address the starting row issue you mentioned.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data want;&lt;/P&gt;&lt;P&gt;&lt;A name="a000289715"&gt;&lt;/A&gt;infile &lt;SPAN class="emphMono"&gt;file-specification&lt;/SPAN&gt; firstobs=5;&lt;/P&gt;&lt;P&gt;input var1 $ 1-5 var2 6-10 var3 $ 11-15;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The example above uses column input which is quite flexible and will allow you to "input" variables in whichever order you like.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 14:27:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174850#M33559</guid>
      <dc:creator>MaikH_Schutze</dc:creator>
      <dc:date>2015-01-08T14:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: Import txt files with difference variable sequnce and concatenate into one file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174851#M33560</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Is there any metadata associated to the files?&amp;nbsp; If not how will you know some columns are the same as other columns, e.g. if file1 has 120 columns, and file 2 have 80 columns, does column 4 mean the same as col4 from previous file etc?&amp;nbsp; If you have some metadata, i.e. information about the structure of each file, then you can use that to create your import programs.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 14:37:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174851#M33560</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-01-08T14:37:23Z</dc:date>
    </item>
    <item>
      <title>Re: Import txt files with difference variable sequnce and concatenate into one file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174852#M33561</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;first I tried to remove the header 3 rows of one txt file, use Proc import with datarow=2 to get it in as a first table with correct column names and format, then use input datafile with firstobs=5 to get all the other files in, and append to the first table with proc SQL union. I get the error indicate data type mismatch for some columns.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I went back to check the data structure by manually remove the 3 header rows of another txt file, import it as the first table above. In log file I can get the column names, format of the variables of these 2 files, I compared the column names, sequence and format of them in excel, and find the difference are only sequence and case of column names&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 14:55:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174852#M33561</guid>
      <dc:creator>Lin_Clare</dc:creator>
      <dc:date>2015-01-08T14:55:01Z</dc:date>
    </item>
    <item>
      <title>Re: Import txt files with difference variable sequnce and concatenate into one file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174853#M33562</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The problem here is that I have ~80 files with each have ~126 columns with different sequnce , it's not realistic to use input and specify each column information (type, name, length) one by one&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually this is only the data for one operation step, I need to process ~200 operations like that. So need to find a more systematci way.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 15:01:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174853#M33562</guid>
      <dc:creator>Lin_Clare</dc:creator>
      <dc:date>2015-01-08T15:01:24Z</dc:date>
    </item>
    <item>
      <title>Re: Import txt files with difference variable sequnce and concatenate into one file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174854#M33563</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Download the macro in this thread &lt;A _jive_internal="true" href="https://communities.sas.com/message/210551#210551"&gt;https://communities.sas.com/message/210551#210551&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will need to define an empty data set as described in the header of the macro as the model for what fields are to be read from the 80 or so files.&amp;nbsp; Like named fields, ignoring case, will be read using the same INFORMAT data type etc.&amp;nbsp; The order of the columns does not matter.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is pretty much is exactly what you need.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 15:08:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174854#M33563</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2015-01-08T15:08:30Z</dc:date>
    </item>
    <item>
      <title>Re: Import txt files with difference variable sequnce and concatenate into one file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174855#M33564</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, see your hitting the issues I noted above, you need to identify a "logical" method of removing header rows/getting column types to then be able to define a "logical" program to import them.&amp;nbsp; Then you would need to know the content and intent of each file to ensure that it matches other tables, for instance:&lt;/P&gt;&lt;P&gt;File 1&lt;/P&gt;&lt;P&gt;VAR1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VAR2&lt;/P&gt;&lt;P&gt;001&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 12DEC12&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;File 2&lt;/P&gt;&lt;P&gt;VAR1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VAR2&lt;/P&gt;&lt;P&gt;1&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 19JAN2014&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now looking at it manually we could probable assume that 001 and 1 are the same (although maybe not, maybe there is a file identifier to be applied?&amp;nbsp; We could probably also guess that the var2 is date in both case, but does the data reference the same thing, i.e. File 1 it could be date of birth, in file 2 date of joining.&amp;nbsp; So a clear understanding of each file needs to be in place, hence why there should be some sort of documentation (specs or metadata), plus I would advise a mapping documentation show which columns go where in the final output.&amp;nbsp; Once you have that, the actual import programs should write themselves.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 15:09:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174855#M33564</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-01-08T15:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: Import txt files with difference variable sequnce and concatenate into one file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174856#M33565</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks. I will try it tomorrow when back to work,&amp;nbsp; can not login into my desk-top right now. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Jan 2015 15:55:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174856#M33565</guid>
      <dc:creator>Lin_Clare</dc:creator>
      <dc:date>2015-01-08T15:55:19Z</dc:date>
    </item>
    <item>
      <title>Re: Import txt files with difference variable sequnce and concatenate into one file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174857#M33566</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hi RW9&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is what the raw txt files looks like&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;#&lt;/P&gt;&lt;P&gt;# Date:10/12/2014 12:19:00 AM&lt;/P&gt;&lt;P&gt;# Batch:1413044241 Route:FL65.8P1CB Event:N/A&lt;/P&gt;&lt;P&gt;Time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A_Rate&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A_sRF&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B_Rate&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B_sRF&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CHA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CHB..... &lt;/P&gt;&lt;P&gt;3111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 26&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 71&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 44&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TI&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FI&amp;nbsp;&amp;nbsp; .....&lt;/P&gt;&lt;P&gt;4210&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 33&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 18&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 68&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 42&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AI&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EI ......&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------------------------------------------- &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;And for example, another file would looks like as below&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;#&lt;/P&gt;&lt;P&gt;# Date:10/11/2014 10:19:00 AM&lt;/P&gt;&lt;P&gt;# Batch:1213043241 Route:FL65.8P1CB Event:N/A&lt;/P&gt;&lt;P&gt;Time&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A_rate&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B_rate&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; A_srf&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; B_srf&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; NR_flow&amp;nbsp;&amp;nbsp; CHA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; CHB..... &lt;/P&gt;&lt;P&gt;3111&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 26&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 71&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 16&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 44&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; G&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; TI&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FI&amp;nbsp;&amp;nbsp; .....&lt;/P&gt;&lt;P&gt;4210&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 33&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 68&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 15&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 42&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; F&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AI&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; EI ......&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am stucked with can not import all the files with column names and format automatically, since there are 3 row headers.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Jan 2015 02:04:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174857#M33566</guid>
      <dc:creator>Lin_Clare</dc:creator>
      <dc:date>2015-01-09T02:04:40Z</dc:date>
    </item>
    <item>
      <title>Re: Import txt files with difference variable sequnce and concatenate into one file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174858#M33567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi data_null_,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your code.&lt;/P&gt;&lt;P&gt;But I am kind of get stucked with preparing the input files. The Macro need all the input files with first row as specific variable names, while I can not get that as my files have some header rows above variable name row.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Jan 2015 02:12:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174858#M33567</guid>
      <dc:creator>Lin_Clare</dc:creator>
      <dc:date>2015-01-09T02:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: Import txt files with difference variable sequnce and concatenate into one file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174859#M33568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just set the macro parameter NAMEROW to 4 when you call the macro so that it will skip the first 3 lines and read the headers from line 4.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Jan 2015 05:11:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174859#M33568</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2015-01-09T05:11:04Z</dc:date>
    </item>
    <item>
      <title>Re: Import txt files with difference variable sequnce and concatenate into one file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174860#M33569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why not use proc import ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;proc import datafile='c:\temp\x.txt' out=x dbms=tab replace;&lt;/P&gt;&lt;P&gt; datarow=4;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Xia Keshan&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Jan 2015 06:21:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174860#M33569</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2015-01-09T06:21:57Z</dc:date>
    </item>
    <item>
      <title>Re: Import txt files with difference variable sequnce and concatenate into one file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174861#M33570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Whilst I normally advise against proc import, in this case it may be the easiest.&amp;nbsp; As for the file, you can pretty easily read it in and drop those line where first line="#".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Something like this:&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile "xyz.txt";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file "xyz.txt";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input buffer $varying256.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if substr(buffer,1,1)="#" then delete;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else put buffer;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Jan 2015 08:58:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174861#M33570</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-01-09T08:58:48Z</dc:date>
    </item>
    <item>
      <title>Re: Import txt files with difference variable sequnce and concatenate into one file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174862#M33571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;How to set the length variable after $varying in this case? sorry I am a SAS newbie. "input buffer $varying256.;" get an error as&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;ERROR: Variable name containing length expected after $VARYING&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Jan 2015 11:49:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174862#M33571</guid>
      <dc:creator>Lin_Clare</dc:creator>
      <dc:date>2015-01-09T11:49:14Z</dc:date>
    </item>
    <item>
      <title>Re: Import txt files with difference variable sequnce and concatenate into one file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174863#M33572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Well the point being is that you are not actually creating your dataset at this point.&amp;nbsp; The example is present to remove any lines with the first character being a hash:&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; length buffer $2000.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; infile "s:\temp\rob\a.txt";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; file "s:\temp\rob\a.txt";&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input buffer $;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if substr(buffer,1,1)="#" then delete;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; else put buffer;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;The file a.txt has 3 rows to start, one with a hash as first character, after program is run there are only two rows.&amp;nbsp; The demonstrates how to remove the header information from your file.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Jan 2015 11:58:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174863#M33572</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2015-01-09T11:58:17Z</dc:date>
    </item>
    <item>
      <title>Re: Import txt files with difference variable sequnce and concatenate into one file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174864#M33573</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Tom,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;below is my code, I get the column and format list of the variables in log file of proc import, only define the first 100 as the last 26~28 are useless to me.&lt;/P&gt;&lt;P&gt;--------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;filename indata "D:\Temp\EP\*.txt" lrecl=32767;&lt;/P&gt;&lt;P&gt;data first;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attrib Lot&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length=$8;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attrib Event&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length=$1;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attrib Product&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length=$10;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attrib Recipe&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length=$10;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attrib Route&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length=$10;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attrib Entity&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length=$6;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attrib LotList&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length=$8;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attrib Date&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; length=8 informat=ANYDTDTM40. format=DATETIME.;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; attrib Time B_oHe_Leak_Rate A_oHe_Leak_Rate B_iHe_Leak_Rate A_iHe_Leak_Rate B_sRF_ref B_sRF B_tRF_ref B_tRF&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; A_sRF_ref A_sRF A_tRF_ref A_tRF robot_rtn robot_xtn HX_rho_dome HX_rho_wall A_wfr_prsnt HX_T_wall HX_T_dome&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; A_wfr_T A_rcp_stp A_CNT_T A_TOP_T A_GSH_T A_SID_T A_iIHC_P A_iIHC_flow A_oIHC_P A_oIHC_flow A_bRF A_bRF_ref&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; A_sO2 A_sAr A_sHe A_sSiH4 A_tHe A_tSiH4 A_tAr A_tO2 A_NF3 A_P A_rTV_stp A_TTV_stp A_echuck_V A_echuck_I B_wfr_prsnt &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; B_wfr_T B_rcp_stp B_CNT_T B_TOP_T B_GSH_T B_SID_T B_iIHC_P B_iIHC_flow B_oIHC_P B_oIHC_flow B_bRF B_bRF_ref&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; B_sO2 B_sAr B_sHe B_sSiH4 B_tHe B_tSiH4 B_tAr B_tO2 B_NF3 B_P B_rTV_stp B_TTV_stp B_echuck_V B_echuck_I HX_flow_wall&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; HX_flow_dome CF_xtn_corr CF_rot_corr A_foreline_P B_foreline_P A_slot B_slot A_elapsed_stp_time B_elapsed_stp_time&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; buffer_P Buffer_N2_flow Buffer_N20_Setpoint ChamberA ChamberB ChamberC ChamberD Batch Operation length=8;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; stop;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; call missing(of _all_);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; run;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;csvReader macro definition lines&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;%csvReader(data=first,out=final,fileref=indata,fileNameLength=$500,namerow=4);&lt;/P&gt;&lt;P&gt;------------------------------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;P&gt;and get error for every raw file like below&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: The infile INDATA is:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Filename=D:\Temp\EP\141012_040223_0511_K4411740.txt,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; File List=D:\Temp\EP\*.txt,RECFM=V,LRECL=32767&lt;/P&gt;&lt;P&gt;NOTE: The data set WORK.CSVREADER_VINFO has 102 observations and 3 variables.&lt;BR /&gt;ERROR: Invalid data set name at line 9 column 218.&lt;BR /&gt;ERROR: An error has occurred during instance method OM_OUTPUT(505) of "DATASTEP.HASH".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Actually the 218th column in the raw file is empty with column name as "SubEntityId___5", not sure why it get an error in line 9 specifically.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Jan 2015 12:03:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174864#M33573</guid>
      <dc:creator>Lin_Clare</dc:creator>
      <dc:date>2015-01-09T12:03:30Z</dc:date>
    </item>
    <item>
      <title>Re: Import txt files with difference variable sequnce and concatenate into one file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174865#M33574</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It works, but still need to add some codes to do that for all the 80 files,output file name sepcified after file stament can not be the same as the input file after infile satment, otherwise the file will not be updated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RW9, Thanks for you explains.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Jan 2015 12:59:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174865#M33574</guid>
      <dc:creator>Lin_Clare</dc:creator>
      <dc:date>2015-01-09T12:59:46Z</dc:date>
    </item>
    <item>
      <title>Re: Import txt files with difference variable sequnce and concatenate into one file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174866#M33575</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This statement is causing the error&lt;/P&gt;&lt;P&gt;finfo.output(dataset:cats("%unquote(&amp;amp;finfodatasetrootname)",filename));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;but is it not essential so you could comment it out and see if that fixes it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My program assumes that the FILENAME(s) can be used as SAS names and that doesn't seem to work here.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Jan 2015 13:31:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174866#M33575</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2015-01-09T13:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: Import txt files with difference variable sequnce and concatenate into one file</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174867#M33576</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, after comment it, there is no error.&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Jan 2015 15:07:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-txt-files-with-difference-variable-sequnce-and/m-p/174867#M33576</guid>
      <dc:creator>Lin_Clare</dc:creator>
      <dc:date>2015-01-09T15:07:19Z</dc:date>
    </item>
  </channel>
</rss>

