<?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: Newlines in CSV file see to fail with PROC IMPORT in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/Newlines-in-CSV-file-see-to-fail-with-PROC-IMPORT/m-p/11957#M1542</link>
    <description>I tried upon this contents (a french one saved in utf8) but showed here in windows&lt;BR /&gt;
[PRE]&lt;BR /&gt;
Nom,AdressÃ©&lt;BR /&gt;
"Bob","citÃ© BergÃ¨re"&lt;BR /&gt;
"Ann","impasse &lt;BR /&gt;
DÃ´me"   &lt;BR /&gt;
[/PRE]&lt;BR /&gt;
with this code under sas windows&lt;BR /&gt;
[PRE]&lt;BR /&gt;
options validvarname=any;&lt;BR /&gt;
filename a "z:\utf8.csv"  encoding=utf8;&lt;BR /&gt;
PROC IMPORT OUT= WORK.PAPER3&lt;BR /&gt;
DATAFILE=a&lt;BR /&gt;
DBMS=CSV REPLACE;&lt;BR /&gt;
GETNAMES=YES;&lt;BR /&gt;
DATAROW=2;&lt;BR /&gt;
RUN; &lt;BR /&gt;
[/PRE]&lt;BR /&gt;
the results are&lt;BR /&gt;
[PRE]&lt;BR /&gt;
Nom	Adressé&lt;BR /&gt;
Bob	cité Bergère&lt;BR /&gt;
Ann	"impasse&lt;BR /&gt;
Dôme"	&lt;BR /&gt;
[/PRE]&lt;BR /&gt;
&lt;BR /&gt;
But as soon as i have a third variable the solution is going down!&lt;BR /&gt;
&lt;BR /&gt;
I think the only sas solution is to &lt;BR /&gt;
-read each line of  the external file &lt;BR /&gt;
-suppress the line break&lt;BR /&gt;
and rewrite it &lt;BR /&gt;
&lt;BR /&gt;
Andre</description>
    <pubDate>Tue, 22 Apr 2008 16:29:40 GMT</pubDate>
    <dc:creator>Andre</dc:creator>
    <dc:date>2008-04-22T16:29:40Z</dc:date>
    <item>
      <title>Newlines in CSV file see to fail with PROC IMPORT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Newlines-in-CSV-file-see-to-fail-with-PROC-IMPORT/m-p/11952#M1537</link>
      <description>I am running PROC IMPORT on a CSV file.  My CSV file opens fine in MS Excel.  However, the newline characters inside the quoted cells seem to cause PROC IMPORT to do the wrong thing.  PROC IMPORT is seeing an end of line and assuming "next record".&lt;BR /&gt;
&lt;BR /&gt;
Any suggestions?&lt;BR /&gt;
&lt;BR /&gt;
Here is the code I am running&lt;BR /&gt;
PROC IMPORT OUT= WORK.PAPER3 &lt;BR /&gt;
            DATAFILE= "C:\Documents and Settings\jleveille\Desktop\paperauthor.csv" &lt;BR /&gt;
            DBMS=CSV REPLACE;&lt;BR /&gt;
     GETNAMES=YES;&lt;BR /&gt;
     DATAROW=2; &lt;BR /&gt;
RUN;</description>
      <pubDate>Fri, 18 Apr 2008 16:56:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Newlines-in-CSV-file-see-to-fail-with-PROC-IMPORT/m-p/11952#M1537</guid>
      <dc:creator>John_d_WiseGuy</dc:creator>
      <dc:date>2008-04-18T16:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: Newlines in CSV file see to fail with PROC IMPORT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Newlines-in-CSV-file-see-to-fail-with-PROC-IMPORT/m-p/11953#M1538</link>
      <description>Another reason to hate Excel for data!  I've usually ended up going through the excel file and manually deleting the offending linefeeds.  It would be nice if there were an easier way.</description>
      <pubDate>Mon, 21 Apr 2008 16:08:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Newlines-in-CSV-file-see-to-fail-with-PROC-IMPORT/m-p/11953#M1538</guid>
      <dc:creator>Doc_Duke</dc:creator>
      <dc:date>2008-04-21T16:08:36Z</dc:date>
    </item>
    <item>
      <title>Sometimes Microsoft can be your friend</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Newlines-in-CSV-file-see-to-fail-with-PROC-IMPORT/m-p/11954#M1539</link>
      <description>For once, don't blame Microsoft -- the CSV file may not have been created by a Microsoft product!  &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;BR /&gt;
&lt;BR /&gt;
And, since Excel can read the CSV file correctly, it actually makes it easy to get it into SAS. Just open the CSV file in Excel and save it as an Excel file (XLS). Then run PROC IMPORT on the converted file.</description>
      <pubDate>Mon, 21 Apr 2008 17:13:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Newlines-in-CSV-file-see-to-fail-with-PROC-IMPORT/m-p/11954#M1539</guid>
      <dc:creator>MikeRhoads</dc:creator>
      <dc:date>2008-04-21T17:13:13Z</dc:date>
    </item>
    <item>
      <title>Re: Newlines in CSV file see to fail with PROC IMPORT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Newlines-in-CSV-file-see-to-fail-with-PROC-IMPORT/m-p/11955#M1540</link>
      <description>Uh, I think you have misunderstood me.  The newlines are part of the data.  They should be in there.  No reason to hate Microsoft here.  PROC IMPORT is doing the wrong thing.  The quoted string does not end, but the record does because of the newline.  The quoted field carrys over to the next record in the file.  When I open the CSV in Microsoft it opens properly.&lt;BR /&gt;
&lt;BR /&gt;
Here is an example of the CSV file&lt;BR /&gt;
&lt;BR /&gt;
Name, Address&lt;BR /&gt;
"Bob", "123 Sycamore Ln"&lt;BR /&gt;
"Fred", "200 Main St&lt;BR /&gt;
Apt 200"&lt;BR /&gt;
&lt;BR /&gt;
Notice that the second address contains a line break.  PROC IMPORT chokes on this.&lt;BR /&gt;
&lt;BR /&gt;
As for the solution from Mike, I realize that I can do what you describe to open and save, however, this presents another problem.  MS Excel assumes that the CSV is ASCII data which it isn't.  It is a UTF-8 file.  So opening CSV and saving to XLS causes transcoding of characters such as the registered trademark symbol.  Ouch.</description>
      <pubDate>Mon, 21 Apr 2008 17:58:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Newlines-in-CSV-file-see-to-fail-with-PROC-IMPORT/m-p/11955#M1540</guid>
      <dc:creator>John_d_WiseGuy</dc:creator>
      <dc:date>2008-04-21T17:58:22Z</dc:date>
    </item>
    <item>
      <title>Re: Newlines in CSV file see to fail with PROC IMPORT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Newlines-in-CSV-file-see-to-fail-with-PROC-IMPORT/m-p/11956#M1541</link>
      <description>it would be nice if the TERMSTR infile option were to take affect within the CSV file import. &lt;BR /&gt;
Just by it's name the option value TERMSTR=CRLF implies that within a cell, the embedded newline character  (just the LF i.e. 0Ax on its own) should not be treated as the TERMSTR. I understand that a defect has been recognised for SAS9.2.&lt;BR /&gt;
&lt;BR /&gt;
Perhaps it will become easier to deal with this problem once the defect is fixed.&lt;BR /&gt;
&lt;BR /&gt;
PeterC</description>
      <pubDate>Tue, 22 Apr 2008 15:57:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Newlines-in-CSV-file-see-to-fail-with-PROC-IMPORT/m-p/11956#M1541</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2008-04-22T15:57:17Z</dc:date>
    </item>
    <item>
      <title>Re: Newlines in CSV file see to fail with PROC IMPORT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Newlines-in-CSV-file-see-to-fail-with-PROC-IMPORT/m-p/11957#M1542</link>
      <description>I tried upon this contents (a french one saved in utf8) but showed here in windows&lt;BR /&gt;
[PRE]&lt;BR /&gt;
Nom,AdressÃ©&lt;BR /&gt;
"Bob","citÃ© BergÃ¨re"&lt;BR /&gt;
"Ann","impasse &lt;BR /&gt;
DÃ´me"   &lt;BR /&gt;
[/PRE]&lt;BR /&gt;
with this code under sas windows&lt;BR /&gt;
[PRE]&lt;BR /&gt;
options validvarname=any;&lt;BR /&gt;
filename a "z:\utf8.csv"  encoding=utf8;&lt;BR /&gt;
PROC IMPORT OUT= WORK.PAPER3&lt;BR /&gt;
DATAFILE=a&lt;BR /&gt;
DBMS=CSV REPLACE;&lt;BR /&gt;
GETNAMES=YES;&lt;BR /&gt;
DATAROW=2;&lt;BR /&gt;
RUN; &lt;BR /&gt;
[/PRE]&lt;BR /&gt;
the results are&lt;BR /&gt;
[PRE]&lt;BR /&gt;
Nom	Adressé&lt;BR /&gt;
Bob	cité Bergère&lt;BR /&gt;
Ann	"impasse&lt;BR /&gt;
Dôme"	&lt;BR /&gt;
[/PRE]&lt;BR /&gt;
&lt;BR /&gt;
But as soon as i have a third variable the solution is going down!&lt;BR /&gt;
&lt;BR /&gt;
I think the only sas solution is to &lt;BR /&gt;
-read each line of  the external file &lt;BR /&gt;
-suppress the line break&lt;BR /&gt;
and rewrite it &lt;BR /&gt;
&lt;BR /&gt;
Andre</description>
      <pubDate>Tue, 22 Apr 2008 16:29:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Newlines-in-CSV-file-see-to-fail-with-PROC-IMPORT/m-p/11957#M1542</guid>
      <dc:creator>Andre</dc:creator>
      <dc:date>2008-04-22T16:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: Newlines in CSV file see to fail with PROC IMPORT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Newlines-in-CSV-file-see-to-fail-with-PROC-IMPORT/m-p/934756#M83553</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/12"&gt;@deleted_user&lt;/a&gt;&amp;nbsp;,&amp;nbsp;&lt;SPAN&gt;TERMSTR=CRLF really worked!&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Somehow I was stuck up at a problem where I was not using&amp;nbsp;TERMSTR=CRLF but when I used it, it worked for me.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;- Dr. Abhijeet Safai&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2024 09:51:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Newlines-in-CSV-file-see-to-fail-with-PROC-IMPORT/m-p/934756#M83553</guid>
      <dc:creator>DrAbhijeetSafai</dc:creator>
      <dc:date>2024-07-05T09:51:31Z</dc:date>
    </item>
    <item>
      <title>Re: Newlines in CSV file see to fail with PROC IMPORT</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/Newlines-in-CSV-file-see-to-fail-with-PROC-IMPORT/m-p/934757#M83554</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13835"&gt;@John_d_WiseGuy&lt;/a&gt;&amp;nbsp;, as&amp;nbsp;@deleted_user has mentioned in his post,&amp;nbsp;&lt;SPAN&gt;TERMSTR=CRLF in filename statement has helped me. Thanks for asking this question.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;- Dr. Abhijeet Safai&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jul 2024 09:57:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/Newlines-in-CSV-file-see-to-fail-with-PROC-IMPORT/m-p/934757#M83554</guid>
      <dc:creator>DrAbhijeetSafai</dc:creator>
      <dc:date>2024-07-05T09:57:23Z</dc:date>
    </item>
  </channel>
</rss>

