<?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: Cannot import text file in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Cannot-import-text-file/m-p/100086#M28097</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;notepad++ is another free editor which allows you to see all the hidden stuff&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 08 Apr 2013 10:09:31 GMT</pubDate>
    <dc:creator>Patrick</dc:creator>
    <dc:date>2013-04-08T10:09:31Z</dc:date>
    <item>
      <title>Cannot import text file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Cannot-import-text-file/m-p/100078#M28089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi, I have the following codes to import a text file but it did not work. Can someone help me with this? I also include the file here&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;filename myFile "C:\Users\Desktop\SAS\Lq_factor.txt";&lt;/P&gt;&lt;P&gt;data sasdata.ps_lq_factor;&lt;/P&gt;&lt;P&gt;format dt yymmn6.;&lt;/P&gt;&lt;P&gt;infile myFile missover;&lt;/P&gt;&lt;P&gt;input @;&lt;/P&gt;&lt;P&gt;if anyalpha(_infile_) = 0 and length(trimn(_infile_)) &amp;gt; 0 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; input dttxt $ Level_lq&amp;nbsp;&amp;nbsp;&amp;nbsp; non_traded_lq traded_lq;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if length(trim(dttxt)) = 6 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dt = input(dttxt, yymmn6.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;drop dttxt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank You very much!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Apr 2013 22:17:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Cannot-import-text-file/m-p/100078#M28089</guid>
      <dc:creator>thdang</dc:creator>
      <dc:date>2013-04-06T22:17:26Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot import text file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Cannot-import-text-file/m-p/100079#M28090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You were awfully close.&amp;nbsp; You just left out one line to account for when your condition wasn't met.&amp;nbsp; i.e.:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data sasdata.ps_lq_factor;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format dt yymmn6.;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile myFile missover;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input @;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if anyalpha(_infile_) = 0 and length(trimn(_infile_)) &amp;gt; 0 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; input dttxt $ Level_lq&amp;nbsp;&amp;nbsp;&amp;nbsp; non_traded_lq traded_lq;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if length(trim(dttxt)) = 6 then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; dt = input(dttxt, yymmn6.);&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; output;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; else input;&lt;/P&gt;&lt;P&gt;&amp;nbsp; drop dttxt;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Apr 2013 22:27:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Cannot-import-text-file/m-p/100079#M28090</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-04-06T22:27:11Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot import text file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Cannot-import-text-file/m-p/100080#M28091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;But it still does not work &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Apr 2013 22:34:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Cannot-import-text-file/m-p/100080#M28091</guid>
      <dc:creator>thdang</dc:creator>
      <dc:date>2013-04-06T22:34:39Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot import text file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Cannot-import-text-file/m-p/100081#M28092</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It's not working because the delimiter in your file are Tabs and not Blanks.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Add "expandtabs" to Art's code and it will work.&lt;/P&gt;&lt;P&gt;infile myFile missover &lt;STRONG&gt;expandtabs&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Alternatively some code like below would also do the job:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data sasdata.ps_lq_factor;&lt;BR /&gt;&amp;nbsp; infile myFile truncover dlm=' ' expandtabs;&lt;/P&gt;&lt;P&gt;&amp;nbsp; format dt yymmn6.;&lt;BR /&gt;&amp;nbsp; input @1 dt ?? :yymmn6. @;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if not missing(dt);&lt;/P&gt;&lt;P&gt;&amp;nbsp; input Level_lq:best32. non_traded_lq:best32. traded_lq:best32.;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 Apr 2013 23:49:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Cannot-import-text-file/m-p/100081#M28092</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2013-04-06T23:49:05Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot import text file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Cannot-import-text-file/m-p/100082#M28093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why not just skip the header?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data want ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; infile 'myfile' dlm='09'x firstobs=13 truncover ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; input month yymmn&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;6. col2-col4 ;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; format month yymmn6.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the header is variable in length then you can test for header lines and skip them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;data want ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; infile 'myfile' dlm='09'x truncover ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; input @ ;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; if _infile_ in: ('%','09'x) then delete ;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; input month yymmn&lt;SPAN style="font-size: 10pt; line-height: 1.5em;"&gt;6. col2-col4 ;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp;&amp;nbsp; format month yymmn6.;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;run;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Apr 2013 01:27:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Cannot-import-text-file/m-p/100082#M28093</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2013-04-07T01:27:15Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot import text file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Cannot-import-text-file/m-p/100083#M28094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you! I have it now.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Apr 2013 17:41:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Cannot-import-text-file/m-p/100083#M28094</guid>
      <dc:creator>thdang</dc:creator>
      <dc:date>2013-04-07T17:41:44Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot import text file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Cannot-import-text-file/m-p/100084#M28095</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;so how do we actually know dlm is not space but&amp;nbsp; tabs?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 Apr 2013 23:21:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Cannot-import-text-file/m-p/100084#M28095</guid>
      <dc:creator>Tal</dc:creator>
      <dc:date>2013-04-07T23:21:11Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot import text file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Cannot-import-text-file/m-p/100085#M28096</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You can use SAS to view a file's data in its hex representation.&amp;nbsp; I, personally, prefer to just view it using a free viewer, such as: &lt;/P&gt;&lt;P&gt;&lt;A href="http://www.brothersoft.com/hexmad-192653.html" title="http://www.brothersoft.com/hexmad-192653.html"&gt;Download Free HexMad, HexMad 0.2.1 Download&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I didn't, in this case, as I had just copied and pasted the text, and read it with a cards statement and never even knew (or had to know) that there were tab characters.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Apr 2013 00:47:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Cannot-import-text-file/m-p/100085#M28096</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2013-04-08T00:47:41Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot import text file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Cannot-import-text-file/m-p/100086#M28097</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;notepad++ is another free editor which allows you to see all the hidden stuff&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Apr 2013 10:09:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Cannot-import-text-file/m-p/100086#M28097</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2013-04-08T10:09:31Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot import text file</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Cannot-import-text-file/m-p/100087#M28098</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;thanks &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Apr 2013 17:31:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Cannot-import-text-file/m-p/100087#M28098</guid>
      <dc:creator>Tal</dc:creator>
      <dc:date>2013-04-10T17:31:08Z</dc:date>
    </item>
  </channel>
</rss>

