<?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 Reading CSV file with variable term strings (CR and CRLF) in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reading-CSV-file-with-variable-term-strings-CR-and-CRLF/m-p/440547#M110063</link>
    <description>&lt;P&gt;I have a CSV file where some records end with CR, and other records end with CRLF.&amp;nbsp; Luckily, there are no embedded CR or CRLF.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So file is like below (actual file has pipe-delimited records with variable lengths, variable number of fields, etc).&lt;/P&gt;
&lt;PRE&gt;1 CRLF
2 CR
3 CRLF
4 &lt;/PRE&gt;
&lt;P&gt;I need to read the file using SAS 9.4 on Windows.&amp;nbsp; I had hope that I could specify on the INFILE statement multiple delimiters, something like termstr=CR|CRLF. But seems that isn't allowed.&amp;nbsp; Now I thinking I could just read in the file with termstr=CR, and then remove the LF from the data.&amp;nbsp; Something like:&lt;/P&gt;
&lt;PRE&gt;data want ;
  infile "c:\junk\have.txt" termstr=CR;
  input @; 
  _infile_ = compress(_infile_,'0A'x); 
  input x 1. ;
run ;&lt;/PRE&gt;
&lt;P&gt;Before I go too far down this path, wanted to ask about possible better alternatives.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Feb 2018 16:11:58 GMT</pubDate>
    <dc:creator>Quentin</dc:creator>
    <dc:date>2018-02-27T16:11:58Z</dc:date>
    <item>
      <title>Reading CSV file with variable term strings (CR and CRLF)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-CSV-file-with-variable-term-strings-CR-and-CRLF/m-p/440547#M110063</link>
      <description>&lt;P&gt;I have a CSV file where some records end with CR, and other records end with CRLF.&amp;nbsp; Luckily, there are no embedded CR or CRLF.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So file is like below (actual file has pipe-delimited records with variable lengths, variable number of fields, etc).&lt;/P&gt;
&lt;PRE&gt;1 CRLF
2 CR
3 CRLF
4 &lt;/PRE&gt;
&lt;P&gt;I need to read the file using SAS 9.4 on Windows.&amp;nbsp; I had hope that I could specify on the INFILE statement multiple delimiters, something like termstr=CR|CRLF. But seems that isn't allowed.&amp;nbsp; Now I thinking I could just read in the file with termstr=CR, and then remove the LF from the data.&amp;nbsp; Something like:&lt;/P&gt;
&lt;PRE&gt;data want ;
  infile "c:\junk\have.txt" termstr=CR;
  input @; 
  _infile_ = compress(_infile_,'0A'x); 
  input x 1. ;
run ;&lt;/PRE&gt;
&lt;P&gt;Before I go too far down this path, wanted to ask about possible better alternatives.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2018 16:11:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-CSV-file-with-variable-term-strings-CR-and-CRLF/m-p/440547#M110063</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2018-02-27T16:11:58Z</dc:date>
    </item>
    <item>
      <title>Re: Reading CSV file with variable term strings (CR and CRLF)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-CSV-file-with-variable-term-strings-CR-and-CRLF/m-p/440655#M110128</link>
      <description>&lt;P&gt;That should work.&lt;/P&gt;
&lt;P&gt;But are you sure that you don't actually have a file with CRLF as end of line and some string fields with embedded CR values?&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2018 20:34:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-CSV-file-with-variable-term-strings-CR-and-CRLF/m-p/440655#M110128</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-02-27T20:34:00Z</dc:date>
    </item>
    <item>
      <title>Re: Reading CSV file with variable term strings (CR and CRLF)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-CSV-file-with-variable-term-strings-CR-and-CRLF/m-p/440657#M110130</link>
      <description>&lt;P&gt;Thanks Tom.&amp;nbsp; Yes, pretty sure. : )&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2018 20:41:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-CSV-file-with-variable-term-strings-CR-and-CRLF/m-p/440657#M110130</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2018-02-27T20:41:37Z</dc:date>
    </item>
    <item>
      <title>Re: Reading CSV file with variable term strings (CR and CRLF)</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-CSV-file-with-variable-term-strings-CR-and-CRLF/m-p/440871#M110224</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Very interesting Question.&lt;/P&gt;
&lt;P&gt;How about make LF as a delimiter ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data x;
infile 'c:\temp\test.txt' termstr=cr dlm='200A'x;
input x ;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 28 Feb 2018 13:15:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-CSV-file-with-variable-term-strings-CR-and-CRLF/m-p/440871#M110224</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-02-28T13:15:37Z</dc:date>
    </item>
  </channel>
</rss>

