<?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 Problem reading csv files. (Some records are wrapped). in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43292#M8876</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Tom,&lt;/P&gt;&lt;P&gt;how can i determine that?&lt;/P&gt;&lt;P&gt;I suppose that description field was wrapped by entering Alt+Enter in the system where data was generated.&lt;/P&gt;&lt;P&gt;I see that wrapped lines contain square symbol.&lt;/P&gt;&lt;P&gt;I don't know how to explain this more definitely.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oleg.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 27 Mar 2012 09:17:39 GMT</pubDate>
    <dc:creator>Oleg_L</dc:creator>
    <dc:date>2012-03-27T09:17:39Z</dc:date>
    <item>
      <title>Problem reading csv files. (Some records are wrapped).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43283#M8867</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello SAS-users.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have to import a lot of .csv files to SAS dataset. The csv delimiter is Tab ('09'x).&lt;/P&gt;&lt;P&gt;The files were imported from a Business Objects query.&lt;/P&gt;&lt;P&gt;Some records are wrapped to two strings in csv files (by Alt+Enter in a description character field).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How can i import these files correctly with infile statement?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I use SAS EG 4.3 under Windows server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've tried option termstr="crlf" but the output dataset contains no observations in this case. The log is below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;14 data test;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;15 infile "\\sasabm01.region.vtb.ru\UOLib\PLI_FX\Input\2012\Loans_cnt\MSK_20120201_20120215.csv"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;16 firstobs=2 dlm='09'x dsd truncover encoding='utf-8' termstr="crlf";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;17 informat dt ymddttm19. debet $20. credit $20. sum_rur commax17. txt $100.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;18 input dt -- txt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;19 run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: The infile "\\sasabm01.region.vtb.ru\UOLib\PLI_FX\Input\2012\Loans_cnt\MSK_20120201_20120215.csv" is:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Filename=\\sasabm01.region.vtb.ru\UOLib\PLI_FX\Input\2012\Loans_cnt\MSK_20120201_20120215.csv,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;RECFM=V,LRECL=1536,File Size (bytes)=1434841,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Last Modified=26Mar2012:11:37:42,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Create Time=26Mar2012:12:06:55&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: 0 records were read from the infile "\\sasabm01.region.vtb.ru\UOLib\PLI_FX\Input\2012\Loans_cnt\MSK_20120201_20120215.csv".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: The data set WORK.TEST has 0 observations and 5 variables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NOTE: DATA statement used (Total process time):&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;real time 0.02 seconds&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;user cpu time 0.03 seconds&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;system cpu time 0.00 seconds&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Memory 22971k&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OS Memory 33096k&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Timestamp 26.03.2012 14:58:41&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I've also tried termstr=crlf (without quotes) but this cause an error:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ERROR: Invalid string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FATAL: Unrecoverable I/O error detected in the execution of the DATA step program. Aborted during the EXECUTION phase.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2012 11:45:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43283#M8867</guid>
      <dc:creator>Oleg_L</dc:creator>
      <dc:date>2012-03-26T11:45:16Z</dc:date>
    </item>
    <item>
      <title>Problem reading csv files. (Some records are wrapped).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43284#M8868</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;What version of SAS is running on your SAS server (NOT the version of Enterprise Guide)?&lt;/P&gt;&lt;P&gt;The the TERMSTR option does not really care if you use quotes or not.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I suspect that your CSV file does not have CRLF ('0D0A'x) to mark the end of lines.&lt;/P&gt;&lt;P&gt;Where was the file generated?&amp;nbsp; PC's use CRLF for end of line, but Unix uses just LF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You change check by getting SAS to dump the file to the SAS log for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; infile "......" lrecl=50 recfm=f;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; input ;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; list;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if _n_ &amp;gt; 20 then stop;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2012 11:58:07 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43284#M8868</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-03-26T11:58:07Z</dc:date>
    </item>
    <item>
      <title>Problem reading csv files. (Some records are wrapped).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43285#M8869</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom,&lt;/P&gt;&lt;P&gt;thanks for your reply.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The version of SAS is 9.2 under Windows server 64x.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Files were generated on my PC workstation under Windows XP from Business Objects query and saved through Business Objects interface on my PC.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If i use default option TERMSTR then i have errors in a few records only (where records are wrapped).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oleg. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2012 12:24:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43285#M8869</guid>
      <dc:creator>Oleg_L</dc:creator>
      <dc:date>2012-03-26T12:24:04Z</dc:date>
    </item>
    <item>
      <title>Problem reading csv files. (Some records are wrapped).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43286#M8870</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Oleg: Can you attach a copy of the file here?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2012 15:48:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43286#M8870</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-03-26T15:48:36Z</dc:date>
    </item>
    <item>
      <title>Problem reading csv files. (Some records are wrapped).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43287#M8871</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;When I read a csv (or any variable length record) I always use:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;infile myinfile&amp;nbsp; lrecl=32000 missover pad;&lt;/P&gt;&lt;P&gt;input @001 text $char256.;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;seems to prevent any missed or skipped records.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then I can examine variable "text" and rebuilld the input statement with individual variables.&amp;nbsp; The length of "text" can be adjusted to suit the situation.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2012 17:24:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43287#M8871</guid>
      <dc:creator>OS2Rules</dc:creator>
      <dc:date>2012-03-26T17:24:31Z</dc:date>
    </item>
    <item>
      <title>Problem reading csv files. (Some records are wrapped).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43288#M8872</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Note that the "new" TRUNCOVER option can be used instead of MISSOVER PAD. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Mar 2012 17:49:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43288#M8872</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-03-26T17:49:44Z</dc:date>
    </item>
    <item>
      <title>Problem reading csv files. (Some records are wrapped).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43289#M8873</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Art,&lt;/P&gt;&lt;P&gt;i can not attach the copy of the file here. The information is confidential.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OS2Rules: thanks for you reply. I'll try your approach.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oleg.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 04:16:58 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43289#M8873</guid>
      <dc:creator>Oleg_L</dc:creator>
      <dc:date>2012-03-27T04:16:58Z</dc:date>
    </item>
    <item>
      <title>Problem reading csv files. (Some records are wrapped).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43290#M8874</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; OS2Rules,&lt;/P&gt;&lt;P&gt;thanks for your advise.&lt;/P&gt;&lt;P&gt;I find a solution by using your code, retain and scan function.&lt;/P&gt;&lt;P&gt;Oleg.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 05:37:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43290#M8874</guid>
      <dc:creator>Oleg_L</dc:creator>
      <dc:date>2012-03-27T05:37:53Z</dc:date>
    </item>
    <item>
      <title>Problem reading csv files. (Some records are wrapped).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43291#M8875</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You never explained what your problem was. &lt;/P&gt;&lt;P&gt;Did your lines NOT end with CRLF?&lt;/P&gt;&lt;P&gt;Or did the embedded line breaks include CRLF?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 05:48:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43291#M8875</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-03-27T05:48:44Z</dc:date>
    </item>
    <item>
      <title>Problem reading csv files. (Some records are wrapped).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43292#M8876</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Tom,&lt;/P&gt;&lt;P&gt;how can i determine that?&lt;/P&gt;&lt;P&gt;I suppose that description field was wrapped by entering Alt+Enter in the system where data was generated.&lt;/P&gt;&lt;P&gt;I see that wrapped lines contain square symbol.&lt;/P&gt;&lt;P&gt;I don't know how to explain this more definitely.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oleg.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 09:17:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43292#M8876</guid>
      <dc:creator>Oleg_L</dc:creator>
      <dc:date>2012-03-27T09:17:39Z</dc:date>
    </item>
    <item>
      <title>Problem reading csv files. (Some records are wrapped).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43293#M8877</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; I encountered a similar situation where the last field in a text file contained a long comment with embedded crlf's or lf's. This solution begins by reading the variables of the first record as you normally would except that I add a line pointer hold (@). At this point, the problem is that you do not know if the value of txt var is complete or if parts of it are in subsequent lines of the text file. You need a way to determine if the next line is a new record or a continuation of txt var. Since each record begins with a datetime field, you could easily test if the next line begins with a datetime. Here's the code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;data test;&lt;BR /&gt;infile "c:\data\EmbeddedLineBreak.txt"&lt;BR /&gt;&amp;nbsp;&amp;nbsp; firstobs=2 dlm='09'x dsd end=eof;&lt;BR /&gt;informat dt ymddttm19. debet $20. credit $20. sum_rur comma17. txt $100.;&lt;BR /&gt;format dt datetime.;&lt;BR /&gt;if eof then stop;&lt;BR /&gt;input @1 dt -- txt @; &lt;/P&gt;&lt;P&gt;* this section reads the next line to determine if the first &lt;BR /&gt;* variable is a datetime. if so, then the next record is found. if not,&lt;BR /&gt;* then another part of the txt var is found.;&lt;BR /&gt;length _temp $100;&lt;BR /&gt;do while ( not eof );&lt;BR /&gt;&amp;nbsp;&amp;nbsp; input _temp :$100. @@; * &amp;lt;-- this is important. holds the line pointer.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; * if the input function is not missing then you found the &lt;BR /&gt;&amp;nbsp;&amp;nbsp; * beginning of the next record; &lt;BR /&gt;&amp;nbsp;&amp;nbsp; if input( _temp, ymddttm19. ) ne . then leave; * exit the loop;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; * if the input func returns mising, the _temp var must contain part of the txt var.&lt;BR /&gt;&amp;nbsp;&amp;nbsp; * concatenate _temp to txt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; txt = dequote( catx( ' ', txt, _temp ));&lt;BR /&gt;&amp;nbsp;&amp;nbsp; _error_ = 0;&lt;BR /&gt;end;&lt;BR /&gt;drop _:;&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created a tab-delimited file in Excel. The records look like this:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;dt debit credit sum_rur txt&lt;/P&gt;&lt;P&gt;2012-03-20 09:30:30 client a client b " 10,000 " "This field has an embedded linefeed here&lt;/P&gt;&lt;P&gt;causing a line break in the text file."&lt;/P&gt;&lt;P&gt;2012-03-21 09:30:30 client c client d " 20,000 " "This field has no embedded linefeeds."&lt;/P&gt;&lt;P&gt;2012-03-22 21:30:30 client e client f " 30,000 " "2 embedded linefeeds. The first is here&lt;/P&gt;&lt;P&gt;and another one is here&lt;/P&gt;&lt;P&gt;causing another line break."&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 12:00:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43293#M8877</guid>
      <dc:creator>FloydNevseta</dc:creator>
      <dc:date>2012-03-27T12:00:35Z</dc:date>
    </item>
    <item>
      <title>Problem reading csv files. (Some records are wrapped).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43294#M8878</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much for your help.&lt;/P&gt;&lt;P&gt;It works.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I removed the line from your code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if eof then stop;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oleg.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 13:40:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43294#M8878</guid>
      <dc:creator>Oleg_L</dc:creator>
      <dc:date>2012-03-27T13:40:45Z</dc:date>
    </item>
    <item>
      <title>Problem reading csv files. (Some records are wrapped).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43295#M8879</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;As I said before in the first reply to your thread you can use SAS to get a picture of what is in your file using the LIST statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Mar 2012 15:00:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43295#M8879</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-03-27T15:00:19Z</dc:date>
    </item>
    <item>
      <title>Re: Problem reading csv files. (Some records are wrapped).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43296#M8880</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the embedded line breaks include '0D0A'x and the lines end with '0A'x&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oleg.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Mar 2012 09:44:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43296#M8880</guid>
      <dc:creator>Oleg_L</dc:creator>
      <dc:date>2012-03-28T09:44:15Z</dc:date>
    </item>
    <item>
      <title>Re: Problem reading csv files. (Some records are wrapped).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43297#M8881</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Because the end-of-line and middle of line strings are different you might be able to use the file.&lt;/P&gt;&lt;P&gt;For example here is a sample program to convert those embedded CRLF into |.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%let lf='0A'x;&lt;/P&gt;&lt;P&gt;%let cr='0D'x;&lt;/P&gt;&lt;P&gt;filename tmpfile1 temp;&lt;/P&gt;&lt;P&gt;filename tmpfile2 temp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* Generate a sample file with an embedded CRLF ;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; file tmpfile1 recfm=n;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put '1,Line is fine' &amp;amp;LF&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '2,Line has ' &amp;amp;CR &amp;amp;LF 'a line break' &amp;amp;LF&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '3,Line is fine' &amp;amp;LF&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;amp;LF&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; '5,Previous line is blank' &amp;amp;LF&lt;/P&gt;&lt;P&gt;&amp;nbsp; @;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* Look at it ;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile tmpfile1 recfm=f ;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input;&lt;/P&gt;&lt;P&gt;&amp;nbsp; list;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* Replace terminal CRLF with | instead ;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile tmpfile1 length=ls;&lt;/P&gt;&lt;P&gt;&amp;nbsp; file tmpfile2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input;&lt;/P&gt;&lt;P&gt;&amp;nbsp; if ls then if substr(_infile_,ls)=&amp;amp;CR then do;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; substr(_infile_,ls,1)='|';&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; put _infile_ $varying. ls @;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return;&lt;/P&gt;&lt;P&gt;&amp;nbsp; end;&lt;/P&gt;&lt;P&gt;&amp;nbsp; put _infile_;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;* Look at the new file;&lt;/P&gt;&lt;P&gt;data _null_;&lt;/P&gt;&lt;P&gt;&amp;nbsp; infile tmpfile2;&lt;/P&gt;&lt;P&gt;&amp;nbsp; input;&lt;/P&gt;&lt;P&gt;&amp;nbsp; list;&lt;/P&gt;&lt;P&gt;run;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Mar 2012 11:58:02 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43297#M8881</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-03-28T11:58:02Z</dc:date>
    </item>
    <item>
      <title>Problem reading csv files. (Some records are wrapped).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43298#M8882</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt; Tom,&lt;/P&gt;&lt;P&gt;I tried your code. No success.&lt;/P&gt;&lt;P&gt;I suppose that your code adds '0D'x (CR) to the end of text lines.&lt;/P&gt;&lt;P&gt;It does not replaces embedded '0D'x (CR) with '|'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Oleg.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Mar 2012 13:52:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43298#M8882</guid>
      <dc:creator>Oleg_L</dc:creator>
      <dc:date>2012-03-28T13:52:20Z</dc:date>
    </item>
    <item>
      <title>Problem reading csv files. (Some records are wrapped).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43299#M8883</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The example works find on Unix.&amp;nbsp; If you are running on Windows then it might not work without adding TERMSTR=LF to the INFILE statement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 28 Mar 2012 15:38:16 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43299#M8883</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-03-28T15:38:16Z</dc:date>
    </item>
    <item>
      <title>Problem reading csv files. (Some records are wrapped).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43300#M8884</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Tom,&lt;/P&gt;&lt;P&gt;thanks a lot for your help.&lt;/P&gt;&lt;P&gt;It works fine with TERMSTR=LF on Windows.&lt;/P&gt;&lt;P&gt;Oleg.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Mar 2012 04:26:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/43300#M8884</guid>
      <dc:creator>Oleg_L</dc:creator>
      <dc:date>2012-03-29T04:26:18Z</dc:date>
    </item>
    <item>
      <title>Re: Problem reading csv files. (Some records are wrapped).</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/229188#M41450</link>
      <description>&lt;P&gt;I have similar scenario - we get a csv file where some records are wrapped and spanned over couple of lines, instead of single line.&lt;/P&gt;
&lt;P&gt;Also, some of this wrapped lines do not have CRLF, so TERMSTR option is not working. I dont think we can change anything on the source side.&amp;nbsp;Please see some sample recs below, record starts with 50001 is&amp;nbsp;first record, Next record is 60001. I added CRLF just to show how it looks.&amp;nbsp;&amp;nbsp;Is there anyway we can process/ read the file ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;50001,"1233243411","LN","2015-06-05-11.29.14.339000","Please&amp;nbsp;consider this as the text&amp;nbsp;on page 1. &lt;STRONG&gt;CRLF&lt;/STRONG&gt;&lt;BR /&gt;Please provide copy of the page, with date and location,&amp;nbsp;for testing purporse&lt;/P&gt;
&lt;P&gt;hardship.",,"X","845783457FSDF","453454HJGHGHGJ",,&lt;STRONG&gt;CRLF&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;60001,"1234567897","LC","2015-03-05-11.29.14.339000","We receive&amp;nbsp;some xt",,'T',&amp;nbsp;","845783457FSDF","453454HJGHGHGJ",&lt;STRONG&gt;CRLF&lt;/STRONG&gt;&lt;/P&gt;
&lt;DIV id="imcontent" dir="ltr"&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: Courier New; font-size: 10pt; direction: ltr; -ms-word-wrap: break-word;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV dir="ltr"&gt;&lt;SPAN style="color: rgb(0, 0, 0); font-family: Courier New; font-size: 10pt; direction: ltr; -ms-word-wrap: break-word;"&gt;it is a comma delimited file - &lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV dir="ltr"&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;infile&lt;/FONT&gt; &lt;FONT color="#800080" face="Courier New" size="3"&gt;"filename06.csv"&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;delimiter&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt; = &lt;/FONT&gt;&lt;FONT color="#800080" face="Courier New" size="3"&gt;","&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;MISSOVER&lt;/FONT&gt;&amp;nbsp;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;DSD&lt;/FONT&gt; &lt;FONT color="#0000ff" face="Courier New" size="3"&gt;lrecl&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;=&lt;/FONT&gt;&lt;STRONG&gt;&lt;FONT color="#008080" face="Courier New" size="3"&gt;32767&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;&lt;FONT color="#0000ff" face="Courier New" size="3"&gt;end&lt;/FONT&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="3"&gt;&lt;FONT face="Courier New" size="3"&gt;=last ;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;/DIV&gt;</description>
      <pubDate>Thu, 08 Oct 2015 20:09:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Problem-reading-csv-files-Some-records-are-wrapped/m-p/229188#M41450</guid>
      <dc:creator>sasbeginner_us</dc:creator>
      <dc:date>2015-10-08T20:09:44Z</dc:date>
    </item>
  </channel>
</rss>

