<?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: import tab file with column names at second row in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/import-tab-file-with-column-names-at-second-row/m-p/163854#M263535</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;Yes, proc import is simpler and with that you forfeit most of the control over it.&amp;nbsp; Therefore you will likely generate more work for yourself further down the line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Per mfab, I would agree, its likely that odd data within the file to be imported.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 Jul 2014 10:06:49 GMT</pubDate>
    <dc:creator>RW9</dc:creator>
    <dc:date>2014-07-03T10:06:49Z</dc:date>
    <item>
      <title>import tab file with column names at second row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-tab-file-with-column-names-at-second-row/m-p/163845#M263526</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;I have a tab file with column names at second row, and data start from the third row. How can I import this file correctly?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have the following code, which gives the column names as the first row :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;proc import datafile='C:\Users\esi15573\Documents\BOLDLF\D1C21D.tab'&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; out=SIM&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dbms=tab&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; replace;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; GETNAMES= Y;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; datarow=3; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;How could I revise it to get it what I want?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;Thanks,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #000000;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #008000;"&gt;&lt;SPAN style="color: #000000;"&gt;York&lt;/SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jul 2014 14:07:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-tab-file-with-column-names-at-second-row/m-p/163845#M263526</guid>
      <dc:creator>york</dc:creator>
      <dc:date>2014-07-02T14:07:56Z</dc:date>
    </item>
    <item>
      <title>Re: import tab file with column names at second row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-tab-file-with-column-names-at-second-row/m-p/163846#M263527</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello York,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;your should be fine with the solution in this &lt;A _jive_internal="true" href="https://communities.sas.com/message/130014#130014"&gt;Thread&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So for your example, just delete the first row and then start with the second:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename exTemp1 &lt;SPAN class="keyword"&gt;temp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword"&gt;&lt;/SPAN&gt;data _null_;&lt;/P&gt;&lt;P&gt;infile &lt;SPAN class="string"&gt;'&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt;C:\Users\esi15573\Documents\BOLDLF\D1C21D.tab&lt;/SPAN&gt;&lt;SPAN class="string"&gt;' &lt;/SPAN&gt;firstobs=2;&lt;/P&gt;&lt;P&gt;file exTemp1;&lt;/P&gt;&lt;P&gt;input;&lt;/P&gt;&lt;P&gt;put _infile_;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;PROC IMPORT DATAFILE=exTemp1&lt;/P&gt;&lt;P&gt;&amp;nbsp; OUT=SIM&lt;/P&gt;&lt;P&gt;&amp;nbsp; DBMS=TAB&amp;nbsp; REPLACE;&lt;/P&gt;&lt;P&gt;&amp;nbsp; GETNAMES=YES;&lt;/P&gt;&lt;P&gt;RUN;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let us know if you succeeded &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers, Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jul 2014 14:26:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-tab-file-with-column-names-at-second-row/m-p/163846#M263527</guid>
      <dc:creator>mfab</dc:creator>
      <dc:date>2014-07-02T14:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: import tab file with column names at second row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-tab-file-with-column-names-at-second-row/m-p/163847#M263528</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi mfab,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks. The first part of code works to delete the first observation. but the second part of the code did not work. the generated file has all the columns clustered into one column. &lt;/P&gt;&lt;P&gt;Any idea how to revise it?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;York&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jul 2014 14:50:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-tab-file-with-column-names-at-second-row/m-p/163847#M263528</guid>
      <dc:creator>york</dc:creator>
      <dc:date>2014-07-02T14:50:08Z</dc:date>
    </item>
    <item>
      <title>Re: import tab file with column names at second row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-tab-file-with-column-names-at-second-row/m-p/163848#M263529</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi York,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;honestly, I don't know, why that should not work.&lt;/P&gt;&lt;P&gt;I tested it with a little file here myself and it seemed to be working properly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Are you sure, that your file is formatted correctly and delimited with tabs?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jul 2014 14:54:52 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-tab-file-with-column-names-at-second-row/m-p/163848#M263529</guid>
      <dc:creator>mfab</dc:creator>
      <dc:date>2014-07-02T14:54:52Z</dc:date>
    </item>
    <item>
      <title>Re: import tab file with column names at second row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-tab-file-with-column-names-at-second-row/m-p/163849#M263530</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Michael,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks. It might be the tab file problem. Once I converted it to the csv file, and ran again, it works well.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the help.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;York&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jul 2014 15:30:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-tab-file-with-column-names-at-second-row/m-p/163849#M263530</guid>
      <dc:creator>york</dc:creator>
      <dc:date>2014-07-02T15:30:57Z</dc:date>
    </item>
    <item>
      <title>Re: import tab file with column names at second row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-tab-file-with-column-names-at-second-row/m-p/163850#M263531</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just leaving so quick thought, can you not just modify the first the datastep to read the data&lt;/P&gt;&lt;P&gt;filename exTemp1 &lt;SPAN class="keyword"&gt;temp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="keyword"&gt;&lt;/SPAN&gt;data _null_;&lt;/P&gt;&lt;P&gt;infile &lt;SPAN class="string"&gt;'&lt;/SPAN&gt;&lt;SPAN style="color: #008000;"&gt;C:\Users\esi15573\Documents\BOLDLF\D1C21D.tab&lt;/SPAN&gt;&lt;SPAN class="string"&gt;' &lt;/SPAN&gt;firstobs=2 dsd missover;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; VAR1 $&lt;/P&gt;&lt;P&gt;&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;&amp;nbsp; VAR2 $...&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You have far more control over the import that way than using proc import.&amp;nbsp; Do a search here as there are loads of examples of importing delimited files.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jul 2014 15:34:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-tab-file-with-column-names-at-second-row/m-p/163850#M263531</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-07-02T15:34:18Z</dc:date>
    </item>
    <item>
      <title>Re: import tab file with column names at second row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-tab-file-with-column-names-at-second-row/m-p/163851#M263532</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey RW9,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I absolutely second your posting. Proc Import leaves you little control sometimes.&lt;/P&gt;&lt;P&gt;With my example I merely adapted the code from the Thread, I quoted &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great time, everyone!&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jul 2014 16:06:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-tab-file-with-column-names-at-second-row/m-p/163851#M263532</guid>
      <dc:creator>mfab</dc:creator>
      <dc:date>2014-07-02T16:06:13Z</dc:date>
    </item>
    <item>
      <title>Re: import tab file with column names at second row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-tab-file-with-column-names-at-second-row/m-p/163852#M263533</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI RW9,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the suggestion. The reason I prefer Proc import is that it's simpler, whereas input would need to type into the variable names and I have a lot of variables in the file. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Also, I have trouble to define the formats of the variables. &lt;/P&gt;&lt;P&gt;see the following values as example, what's the correct format?&lt;/P&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 64px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD align="right" class="xl63" height="20" width="64"&gt;1.17E+00&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;TABLE border="0" cellpadding="0" cellspacing="0" style="width: 64px;"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD align="right" class="xl65" height="20" width="64"&gt;-1.22E-01&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;I tried e8. and e9., but each only recognize certain columns but not others. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;York&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jul 2014 17:16:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-tab-file-with-column-names-at-second-row/m-p/163852#M263533</guid>
      <dc:creator>york</dc:creator>
      <dc:date>2014-07-02T17:16:31Z</dc:date>
    </item>
    <item>
      <title>Re: import tab file with column names at second row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-tab-file-with-column-names-at-second-row/m-p/163853#M263534</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi York,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;e9. looks fine to me.&lt;/P&gt;&lt;P&gt;I would suggest, you inspect a few lines more closely in Order to find out if there is anything special with the lines/numbers that are not recognized properly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you don't succeed, you might want to post an example of the file and your code, as well as the wrong and desired output, so we could have a look at it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Michael&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;p.s.: you could try to add TERMSTR=CRLF to your infile statement (or TERMSTR=CR or TERMSTR=LF), depending on whether you receive and process your files on unix or windows environments. This might help with certain lines.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jul 2014 08:49:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-tab-file-with-column-names-at-second-row/m-p/163853#M263534</guid>
      <dc:creator>mfab</dc:creator>
      <dc:date>2014-07-03T08:49:25Z</dc:date>
    </item>
    <item>
      <title>Re: import tab file with column names at second row</title>
      <link>https://communities.sas.com/t5/SAS-Programming/import-tab-file-with-column-names-at-second-row/m-p/163854#M263535</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;Yes, proc import is simpler and with that you forfeit most of the control over it.&amp;nbsp; Therefore you will likely generate more work for yourself further down the line.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Per mfab, I would agree, its likely that odd data within the file to be imported.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jul 2014 10:06:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/import-tab-file-with-column-names-at-second-row/m-p/163854#M263535</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2014-07-03T10:06:49Z</dc:date>
    </item>
  </channel>
</rss>

