<?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 UTF-8 Encoded csv File in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Reading-UTF-8-Encoded-csv-File/m-p/438703#M109404</link>
    <description>Cheers &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;BR /&gt;&lt;BR /&gt;I adjusted my prior post to mention carriage returns as well in case anyone comes by to reference this in the future and only reads the solution post.</description>
    <pubDate>Tue, 20 Feb 2018 16:28:49 GMT</pubDate>
    <dc:creator>GinaRepole</dc:creator>
    <dc:date>2018-02-20T16:28:49Z</dc:date>
    <item>
      <title>Reading UTF-8 Encoded csv File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-UTF-8-Encoded-csv-File/m-p/438680#M109389</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to read a utf-8 encoded csv file.&lt;/P&gt;&lt;P&gt;In Notepad++ the file looks fine.&lt;/P&gt;&lt;P&gt;In notepad the whole file comes as 1 line.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I am using a UNIX OS, where SAS 9.4 is installed.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So when SAS reads the file, it is only reading 1 record. As I am using firstobs=2 to avoid reading header, the final dataset contains 0 records.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using the following code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename file1 '/u04/dataloader/Satish/App/ZZ/f1.csv' encoding='utf-8';

data xxx.asdf;
infile file1 dsd dlm=',' firstobs=2 encoding='utf-8';
input SiteNumber:$10. LabName:$30. AnalyteName:$16. FromDate:$20. ToDate:$20. 
      LowRange:best12. HighRange:best12. Units:$10. Dictionary:$10. Comments$10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;I am trying to read the data from line2.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2018 16:04:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-UTF-8-Encoded-csv-File/m-p/438680#M109389</guid>
      <dc:creator>Satish_Parida</dc:creator>
      <dc:date>2018-02-20T16:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: Reading UTF-8 Encoded csv File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-UTF-8-Encoded-csv-File/m-p/438687#M109393</link>
      <description>It sounds to me like the CSV file you're working with has Unix based line endings instead of Windows based line endings, so the records are not being properly split. &lt;BR /&gt;&lt;BR /&gt;I was able to resolve this issue by quickly opening the file in WordPad (instead of Notepad) and saving it under a different name. It automatically corrected the line breaks.</description>
      <pubDate>Tue, 20 Feb 2018 16:00:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-UTF-8-Encoded-csv-File/m-p/438687#M109393</guid>
      <dc:creator>GinaRepole</dc:creator>
      <dc:date>2018-02-20T16:00:01Z</dc:date>
    </item>
    <item>
      <title>Re: Reading UTF-8 Encoded csv File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-UTF-8-Encoded-csv-File/m-p/438688#M109394</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/91713"&gt;@GinaRepole&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can it be done in bash command, or using any utility in base SAS?&lt;BR /&gt;I am trying to automate a batch process. I am using a UNIX OS, where SAS 9.4 is installed.&lt;BR /&gt;This is one example file.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2018 16:04:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-UTF-8-Encoded-csv-File/m-p/438688#M109394</guid>
      <dc:creator>Satish_Parida</dc:creator>
      <dc:date>2018-02-20T16:04:28Z</dc:date>
    </item>
    <item>
      <title>Re: Reading UTF-8 Encoded csv File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-UTF-8-Encoded-csv-File/m-p/438693#M109397</link>
      <description>&lt;P&gt;Oh, I see! If everything about your SAS session is Unix centralized, you should keep it that way. Just add the TERMSTR=LR option onto the INFILE statement and it should read the existing file correctly (or TERMSTR=CR if you may be missing carriage returns).&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2018 16:27:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-UTF-8-Encoded-csv-File/m-p/438693#M109397</guid>
      <dc:creator>GinaRepole</dc:creator>
      <dc:date>2018-02-20T16:27:38Z</dc:date>
    </item>
    <item>
      <title>Re: Reading UTF-8 Encoded csv File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-UTF-8-Encoded-csv-File/m-p/438701#M109402</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/91713"&gt;@GinaRepole&lt;/a&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much.&amp;nbsp;&lt;img id="robothappy" class="emoticon emoticon-robothappy" src="https://communities.sas.com/i/smilies/16x16_robot-happy.png" alt="Robot Happy" title="Robot Happy" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was missing the carriage return.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename file1 '/u04/dataloader/Satish/App/ZZ/f1.csv' encoding='utf-8';

data xxx.asdf;
infile file1 dlm=',' dsd firstobs=2 encoding='utf-8' TERMSTR=CR; /*CR Worked as &lt;SPAN&gt;carriage return&lt;/SPAN&gt;*/
input SiteNumber:$10. LabName:$30. AnalyteName:$16. FromDate:$20. ToDate:$20. 
      LowRange:best12. HighRange:best12. Units:$10. Dictionary:$10. Comments$10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2018 16:25:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-UTF-8-Encoded-csv-File/m-p/438701#M109402</guid>
      <dc:creator>Satish_Parida</dc:creator>
      <dc:date>2018-02-20T16:25:59Z</dc:date>
    </item>
    <item>
      <title>Re: Reading UTF-8 Encoded csv File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-UTF-8-Encoded-csv-File/m-p/438703#M109404</link>
      <description>Cheers &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;BR /&gt;&lt;BR /&gt;I adjusted my prior post to mention carriage returns as well in case anyone comes by to reference this in the future and only reads the solution post.</description>
      <pubDate>Tue, 20 Feb 2018 16:28:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-UTF-8-Encoded-csv-File/m-p/438703#M109404</guid>
      <dc:creator>GinaRepole</dc:creator>
      <dc:date>2018-02-20T16:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: Reading UTF-8 Encoded csv File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-UTF-8-Encoded-csv-File/m-p/438718#M109407</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/138619"&gt;@Satish_Parida&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/91713"&gt;@GinaRepole&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much.&amp;nbsp;&lt;img id="robothappy" class="emoticon emoticon-robothappy" src="https://communities.sas.com/i/smilies/16x16_robot-happy.png" alt="Robot Happy" title="Robot Happy" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I was missing the carriage return.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename file1 '/u04/dataloader/Satish/App/ZZ/f1.csv' encoding='utf-8';

data xxx.asdf;
infile file1 dlm=',' dsd firstobs=2 encoding='utf-8' TERMSTR=CR; /*CR Worked as &lt;SPAN&gt;carriage return&lt;/SPAN&gt;*/
input SiteNumber:$10. LabName:$30. AnalyteName:$16. FromDate:$20. ToDate:$20. 
      LowRange:best12. HighRange:best12. Units:$10. Dictionary:$10. Comments$10.;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Note: As far as I can tell only Microsoft Excel on Mac is still creating files using CR only as the end of line marks.&amp;nbsp; But you can&amp;nbsp;pick a different file format when you save the&amp;nbsp;files from Excel so that it will generate files using LF or CR+LF instead.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2018 16:57:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-UTF-8-Encoded-csv-File/m-p/438718#M109407</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-02-20T16:57:05Z</dc:date>
    </item>
    <item>
      <title>Re: Reading UTF-8 Encoded csv File</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Reading-UTF-8-Encoded-csv-File/m-p/438907#M109471</link>
      <description>&lt;P&gt;If the source of the file is different and we can not predict the line breaks&lt;/P&gt;&lt;P&gt;Can we use more than one TERMSTR option in one data step. like LF+CR&lt;/P&gt;</description>
      <pubDate>Wed, 21 Feb 2018 11:54:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Reading-UTF-8-Encoded-csv-File/m-p/438907#M109471</guid>
      <dc:creator>Satish_Parida</dc:creator>
      <dc:date>2018-02-21T11:54:55Z</dc:date>
    </item>
  </channel>
</rss>

