<?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: Input a CSV file with text fields that contain line breaks + carriage returns and ',' signs in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/833108#M329326</link>
    <description>&lt;P&gt;Yes.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the line breaks are not in quotes deciding whether or not there are extra line breaks is an impossible task.&lt;/P&gt;
&lt;P&gt;You can make it work if you make other assumptions about the file.&amp;nbsp; Things like, the delimiter will never appear as part of the data.&amp;nbsp; The extra line breaks will appear in only specific field(s).&lt;/P&gt;</description>
    <pubDate>Tue, 13 Sep 2022 12:51:53 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2022-09-13T12:51:53Z</dc:date>
    <item>
      <title>Input a CSV file with text fields that contain line breaks + carriage returns and ',' signs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/821603#M324379</link>
      <description>&lt;P&gt;Hello, I want to import a CSV file using the infile and input procedure. The problem is that the column 'review' is a text surrounded by quotas like ".........." and it contains carriage returns + line breaks and contains comma (',') in the text. Is the a way to import this type of csv file?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Example of the data:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;STRONG&gt;n,recommendationid,language,review&lt;/STRONG&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;0,&lt;/SPAN&gt;&lt;SPAN&gt;77060058,&lt;/SPAN&gt;&lt;SPAN&gt;english,&lt;/SPAN&gt;&lt;FONT color="#FF0000"&gt;&lt;SPAN&gt;"Really great game! &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT color="#FF0000"&gt;&lt;SPAN&gt;The story is the most ambitious and inventive campaign ive ever played, it's a must play for anyone who loves Guns, Horses, cowboys, or video games. The Story is emotional and rich and is worth every second. The online portion of this game has gotten better since the original release in 2018; &lt;/SPAN&gt;&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;&lt;FONT color="#FF0000"&gt;However, there is still a lot to be desired. Rockstar is slowly updating it, but this game is worth it for the story mode alone."&lt;/FONT&gt;,&lt;/SPAN&gt;&lt;SPAN&gt;1601870541,&lt;/SPAN&gt;&lt;SPAN&gt;1601870541,&lt;/SPAN&gt;&lt;SPAN&gt;True,&lt;/SPAN&gt;&lt;SPAN&gt;0,&lt;/SPAN&gt;&lt;SPAN&gt;0,&lt;/SPAN&gt;&lt;SPAN&gt;0,&lt;/SPAN&gt;&lt;SPAN&gt;0,&lt;/SPAN&gt;&lt;SPAN&gt;True,&lt;/SPAN&gt;&lt;SPAN&gt;False,&lt;/SPAN&gt;&lt;SPAN&gt;False,&lt;/SPAN&gt;&lt;SPAN&gt;76561198262327743,&lt;/SPAN&gt;&lt;SPAN&gt;33,&lt;/SPAN&gt;&lt;SPAN&gt;9,&lt;/SPAN&gt;&lt;SPAN&gt;2737,&lt;/SPAN&gt;&lt;SPAN&gt;2737,&lt;/SPAN&gt;&lt;SPAN&gt;2737,&lt;/SPAN&gt;&lt;SPAN&gt;1601868447&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;1,&lt;/SPAN&gt;&lt;SPAN&gt;77059990,&lt;/SPAN&gt;&lt;SPAN&gt;english,&lt;/SPAN&gt;&lt;SPAN&gt;"Red Dead Redemption 2. Is there anything I can say that will suffice in describing this masterpiece??? RDR2 is SUCH a good game. It’s definitely my favorite game. Its price is high for good reason. The storage space it takes is worth it. RDR2 is a game that has such an immersive story line. It’s a long, but **bleep** near perfect game. This is the first game that has made me bawl like a baby. If you get this game, or if you’ve already played it, you’ll understand why I cried... That said, I highly recommend this game. Again, **bleep** near perfect.",&lt;/SPAN&gt;&lt;SPAN&gt;1601870400,&lt;/SPAN&gt;&lt;SPAN&gt;1601870400,&lt;/SPAN&gt;&lt;SPAN&gt;True,&lt;/SPAN&gt;&lt;SPAN&gt;0,&lt;/SPAN&gt;&lt;SPAN&gt;0,&lt;/SPAN&gt;&lt;SPAN&gt;0,&lt;/SPAN&gt;&lt;SPAN&gt;0,&lt;/SPAN&gt;&lt;SPAN&gt;True,&lt;/SPAN&gt;&lt;SPAN&gt;False,&lt;/SPAN&gt;&lt;SPAN&gt;False,&lt;/SPAN&gt;&lt;SPAN&gt;76561198303413791,&lt;/SPAN&gt;&lt;SPAN&gt;48,&lt;/SPAN&gt;&lt;SPAN&gt;7,&lt;/SPAN&gt;&lt;SPAN&gt;5029,&lt;/SPAN&gt;&lt;SPAN&gt;0,&lt;/SPAN&gt;&lt;SPAN&gt;5029,&lt;/SPAN&gt;&lt;SPAN&gt;1597432775&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;2,&lt;/SPAN&gt;&lt;SPAN&gt;77058854,&lt;/SPAN&gt;&lt;SPAN&gt;english,&lt;/SPAN&gt;&lt;SPAN&gt;"how to eat monkey,&lt;/SPAN&gt;&lt;/DIV&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;SPAN&gt;ye s&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;",&lt;/SPAN&gt;&lt;SPAN&gt;1601868148,&lt;/SPAN&gt;&lt;SPAN&gt;1601868148,&lt;/SPAN&gt;&lt;SPAN&gt;True,&lt;/SPAN&gt;&lt;SPAN&gt;0,&lt;/SPAN&gt;&lt;SPAN&gt;0,&lt;/SPAN&gt;&lt;SPAN&gt;0,&lt;/SPAN&gt;&lt;SPAN&gt;0,&lt;/SPAN&gt;&lt;SPAN&gt;True,&lt;/SPAN&gt;&lt;SPAN&gt;False,&lt;/SPAN&gt;&lt;SPAN&gt;False,&lt;/SPAN&gt;&lt;SPAN&gt;76561198425061844,&lt;/SPAN&gt;&lt;SPAN&gt;6,&lt;/SPAN&gt;&lt;SPAN&gt;2,&lt;/SPAN&gt;&lt;SPAN&gt;442,&lt;/SPAN&gt;&lt;SPAN&gt;442,&lt;/SPAN&gt;&lt;SPAN&gt;412,&lt;/SPAN&gt;&lt;SPAN&gt;1601869925&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;&lt;/DIV&gt;</description>
      <pubDate>Tue, 05 Jul 2022 14:03:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/821603#M324379</guid>
      <dc:creator>simon_98</dc:creator>
      <dc:date>2022-07-05T14:03:01Z</dc:date>
    </item>
    <item>
      <title>Re: Input a CSV file with text fields that contain line breaks + carriage returns and ',' signs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/821814#M324470</link>
      <description>&lt;P&gt;Can you post some real data? It is depend on the pattern that start a new line .&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data temp;
infile 'c:\temp\have.csv' firstobs=2 length=len ;
input have $varying8000. len;
if missing(have) then delete;
if prxmatch('/^\d{1,},\d{4}/',have) then group+1;
run;
data temp2;
 do until(last.group);
  set temp;
  by group;
  length row $ 30000;
  row=cats(row,have);
 end;
keep group row;
run;
data want;
 set temp2;
n=scan(row,1,',','mq');
recommendationid=scan(row,2,',','mq');
language=scan(row,3,',','mq');
review=scan(row,4,',','mq');
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Jul 2022 12:25:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/821814#M324470</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-07-06T12:25:37Z</dc:date>
    </item>
    <item>
      <title>Re: Input a CSV file with text fields that contain line breaks + carriage returns and ',' signs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/821827#M324475</link>
      <description>&lt;P&gt;Another approach (which will get this in a single pass):&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename readme "c:\temp\have.txt";
data recommendataions;
   length n recommendationid 8 language $20 Recommend $1000;
   drop _: r;
   infile readme dsd _infile_=raw truncover;
   input n recommendationid language:$20. R:$1000.;
   if countc(raw,'"')=2 then do;
      Recommend=r;
      output;
   end;
   else do;
      _first=not (missing(n) and missing(language)); 
      if _first then do until (_n&amp;gt;0);
         input ;
         _n=find(raw,'"');
         if _n=0 then do;
            R=catx(' ',r,raw);
         end;
         else do;
            R=catx(' ',R,substr(raw,1,_n-1));
            if find(r,'"') then Recommend=scan(r,1,'"');
            else Recommend=R;
            output;
            leave;
         end;
      end;
   end;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Result:&lt;/P&gt;
&lt;DIV class="branch"&gt;
&lt;DIV&gt;
&lt;DIV align="center"&gt;
&lt;TABLE class="table" summary="Procedure Print: Data Set WORK.RECOMMENDATAIONS" frame="box" rules="all" cellspacing="0" cellpadding="5"&gt;
&lt;THEAD&gt;
&lt;TR&gt;
&lt;TH class="r header" scope="col"&gt;Obs&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;n&lt;/TH&gt;
&lt;TH class="r header" scope="col"&gt;recommendationid&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;language&lt;/TH&gt;
&lt;TH class="l header" scope="col"&gt;Recommend&lt;/TH&gt;
&lt;/TR&gt;
&lt;/THEAD&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;1&lt;/TH&gt;
&lt;TD class="r data"&gt;0&lt;/TD&gt;
&lt;TD class="r data"&gt;77060058&lt;/TD&gt;
&lt;TD class="l data"&gt;english&lt;/TD&gt;
&lt;TD class="l data"&gt;Really great game! The story is the most ambitious and inventive campaign ive ever played, it's a must play for anyone who loves Guns, Horses, cowboys, or video games. The Story is emotional and rich and is worth every second. The online portion of this game has gotten better since the original release in 2018; However, there is still a lot to be desired. Rockstar is slowly updating it, but this game is worth it for the story mode alone.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;2&lt;/TH&gt;
&lt;TD class="r data"&gt;1&lt;/TD&gt;
&lt;TD class="r data"&gt;77059990&lt;/TD&gt;
&lt;TD class="l data"&gt;english&lt;/TD&gt;
&lt;TD class="l data"&gt;Red Dead Redemption 2. Is there anything I can say that will suffice in describing this masterpiece??? RDR2 is SUCH a good game. It’s definitely my favorite game. Its price is high for good reason. The storage space it takes is worth it. RDR2 is a game that has such an immersive story line. It’s a long, but **bleep** near perfect game. This is the first game that has made me bawl like a baby. If you get this game, or if you’ve already played it, you’ll understand why I cried... That said, I highly recommend this game. Again, **bleep** near perfect.&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH class="r rowheader" scope="row"&gt;3&lt;/TH&gt;
&lt;TD class="r data"&gt;2&lt;/TD&gt;
&lt;TD class="r data"&gt;77058854&lt;/TD&gt;
&lt;TD class="l data"&gt;english&lt;/TD&gt;
&lt;TD class="l data"&gt;how to eat monkey ye s&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TH&gt;&amp;nbsp;&lt;/TH&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;
&lt;/DIV&gt;</description>
      <pubDate>Wed, 06 Jul 2022 13:02:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/821827#M324475</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2022-07-06T13:02:19Z</dc:date>
    </item>
    <item>
      <title>Re: Input a CSV file with text fields that contain line breaks + carriage returns and ',' signs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/821832#M324479</link>
      <description>&lt;P&gt;It depends on what exact characters and character combinations are in the quoted strings.&lt;/P&gt;
&lt;P&gt;Comma and carriage control are characters, but&amp;nbsp;"line break" is not a character, it is a concept.&amp;nbsp; SAS expects end of line characters to indicate the end of each line.&amp;nbsp;The INFILE statement lets you use the TERMSTR= option choose between three different possible end of line character strings.&amp;nbsp; It could be a single linefeed character, '0A'x, a single carriage return character, '0D'x, or a carriage return + line feed combination.&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if the characters that your file is using as the end of line marge is CR+LF and the characters embedded in the strings are only single LF or single CR then just adding TERMSTR=CRLF to your INFILE statement will let you read the file as it is.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note it is hard to tell exactly what you have from text pasted into this forum as the forum editor could be modifying it for its purposes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To see what is in the file look at the actual character codes. The easiest way is to tell SAS to read it as fixed length blocks and dump it to the log using the LIST statement.&amp;nbsp; So to read the first 500 bytes of the file you could use something like this.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  infile 'myfile.csv' lrecl=100 recfm=f obs=100;
  input;
  list;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If you see that the actual end of line characters and the "line breaks" in the middle of the string are using the same actual characters then you will probably want to pre-process the file to fix that.&lt;/P&gt;
&lt;P&gt;You could try this &lt;A href="https://github.com/sasutils/macros/blob/master/replace_crlf.sas" target="_self"&gt;%replace_crlf()&lt;/A&gt; macro&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 13:17:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/821832#M324479</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-07-06T13:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: Input a CSV file with text fields that contain line breaks + carriage returns and ',' signs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/821846#M324488</link>
      <description>&lt;P&gt;Of course, I am sorry to not have included it in the first place.&lt;/P&gt;&lt;P&gt;I attached the original csv file.&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 14:05:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/821846#M324488</guid>
      <dc:creator>simon_98</dc:creator>
      <dc:date>2022-07-06T14:05:27Z</dc:date>
    </item>
    <item>
      <title>Re: Input a CSV file with text fields that contain line breaks + carriage returns and ',' signs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/821847#M324489</link>
      <description>&lt;P&gt;When I try to use&amp;nbsp;&lt;SPAN&gt;TERMSTR=CRLF, it does not give me any output at all.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Attached would be the original csv file.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 06 Jul 2022 14:14:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/821847#M324489</guid>
      <dc:creator>simon_98</dc:creator>
      <dc:date>2022-07-06T14:14:06Z</dc:date>
    </item>
    <item>
      <title>Re: Input a CSV file with text fields that contain line breaks + carriage returns and ',' signs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/821853#M324492</link>
      <description>&lt;P&gt;That is because the end of line markers in that file are just linefeed, which is the default for Unix files.&amp;nbsp; Also that file does NOT use semicolon as the delimiters, just normal old commas.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So fix the embedded LFs and PROC IMPORT can do a reasonable jobs of guessing what is in the file.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename old "c:\downloads\1174180_RedDeadRedemption2_edited2.csv" ;
filename new "c:\downloads\fixed.txt";

%replace_crlf(old,new);

proc import datafile=new out=want replace dbms=csv ;
run;

proc means;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Tom_0-1657117947302.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/72981iDE7A411D21E65F93/image-size/large?v=v2&amp;amp;px=999" role="button" title="Tom_0-1657117947302.png" alt="Tom_0-1657117947302.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;But I suspect that AUTHOR_STEAMID should NOT be defined a NUMERIC.&amp;nbsp; You normally do not need to do arithmetic with ID values.&amp;nbsp; AUTHOR_LAST_PLAYED also does not look like it should be numeric, but its values are not so large that they will cause trouble if stored as a number.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So just write your own data step to read the file.&amp;nbsp; You can write something that is MUCH clearer and easier to understand than the stuff that PROC IMPORT emits.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data WORK.WANT    ;
  infile NEW DSD TRUNCOVER firstobs=2 ;
  length
     n 8
     recommendationid 8
     language $7
     review $1248
     timestamp_created 8
     timestamp_updated 8
     voted_up $5
     votes_up 8
     votes_funny 8
     weighted_vote_score 8
     comment_count 8
     steam_purchase $4
     received_for_free $5
     written_during_early_access $5
     author_steamid $20
     author_num_games_owned 8
     author_num_reviews 8
     author_playtime_forever 8
     author_playtime_last_two_weeks 8
     author_playtime_at_review 8
     author_last_played 8
  ;
  format timestamp_created timestamp_updated author_last_played datetime19.
         author_playtime_forever author_playtime_last_two_weeks author_playtime_at_review time12.
  ;
  input n -- author_last_played;
run;

proc summary;
  var _numeric_;
  output out=summary  ;
run;

proc print data=summary;
 where _stat_ =: 'M';
 id _stat_;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Results&lt;/P&gt;
&lt;PRE&gt;                                                                                                                votes_    weighted_
_STAT_   _TYPE_   _FREQ_      n      recommendationid     timestamp_created     timestamp_updated   votes_up     funny   vote_score

 MIN        0      11580    0.0000      59294641.00      04DEC2009:18:07:58    23MAY2010:15:42:05       0.00     0.000     0.00000
 MAX        0      11580   99.0000      77060058.00      05OCT2010:04:02:21    05OCT2010:04:02:21    3012.00   339.000     0.96853
 MEAN       0      11580   49.4309      72591600.59      15JUL2010:23:53:39    28JUL2010:00:32:56       2.08     0.353     0.17544

                       author_                         author_                             author_
         comment_    num_games_    author_num_       playtime_    author_playtime_       playtime_
_STAT_     count        owned        reviews           forever     last_two_weeks        at_review     author_last_played

 MIN       0.0000         0.00          1.00           0:00:05           0:00:00           0:00:05     05DEC2009:06:06:35
 MAX      68.0000      9708.00       1886.00          91:16:14           5:29:45          89:16:07     07OCT2010:05:59:45
 MEAN      0.0959       122.64         10.08           2:01:41           0:06:58           1:10:39     29AUG2010:03:06:36
&lt;/PRE&gt;</description>
      <pubDate>Wed, 06 Jul 2022 14:51:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/821853#M324492</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-07-06T14:51:28Z</dc:date>
    </item>
    <item>
      <title>Re: Input a CSV file with text fields that contain line breaks + carriage returns and ',' signs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/821919#M324514</link>
      <description>Thank You so much, it helped me a lot and it is working now!!</description>
      <pubDate>Wed, 06 Jul 2022 20:11:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/821919#M324514</guid>
      <dc:creator>simon_98</dc:creator>
      <dc:date>2022-07-06T20:11:49Z</dc:date>
    </item>
    <item>
      <title>Re: Input a CSV file with text fields that contain line breaks + carriage returns and ',' signs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/822036#M324572</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Why in your result , there are some '\n' chatacters but in CSV don't have ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1657193863737.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/73024i5825C647DEC54C46/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1657193863737.png" alt="Ksharp_0-1657193863737.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 07 Jul 2022 11:37:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/822036#M324572</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-07-07T11:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: Input a CSV file with text fields that contain line breaks + carriage returns and ',' signs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/822049#M324578</link>
      <description>&lt;P&gt;That is the default replacement character that the &lt;A href="https://github.com/sasutils/macros/blob/master/replace_crlf.sas" target="_self"&gt;%replace_crfl()&lt;/A&gt; macro used for the embedded linefeed characters.&lt;/P&gt;
&lt;P&gt;You can specify something else when you call the macro.&amp;nbsp; Read the source code for the macro to get more help.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro replace_crlf
/*----------------------------------------------------------------------------
Replace carriage return or linefeed characters that are inside quotes
----------------------------------------------------------------------------*/
(infile   /* Fileref or quoted physical name of input file */
,outfile  /* Fileref or quoted physical name of output file */
,cr='\r'  /* Replacement string for carriage return */
,lf='\n'  /* Replacement string for linefeed */
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 07 Jul 2022 13:23:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/822049#M324578</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-07-07T13:23:32Z</dc:date>
    </item>
    <item>
      <title>Re: Input a CSV file with text fields that contain line breaks + carriage returns and ',' signs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/833000#M329292</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;is there a way to run that macro on multiple files, I have this issue with lots of files we get everyday, is there a way to use this macro to loop thru all the files in the directory and apply the cleanup macro.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 12 Sep 2022 20:46:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/833000#M329292</guid>
      <dc:creator>jimbobob</dc:creator>
      <dc:date>2022-09-12T20:46:48Z</dc:date>
    </item>
    <item>
      <title>Re: Input a CSV file with text fields that contain line breaks + carriage returns and ',' signs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/833017#M329298</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13255"&gt;@jimbobob&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;is there a way to run that macro on multiple files, I have this issue with lots of files we get everyday, is there a way to use this macro to loop thru all the files in the directory and apply the cleanup macro.&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The easiest way is to make a dataset with the names of the files and use that to generate a separate macro call for each file.&lt;/P&gt;
&lt;P&gt;There are plenty of postings on the site (and even some examples in the SAS manuals, see DREAD() function) for how to make the list.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data _null_;
  set list ;
  call execute(cats('%nrstr(replace_crlf)(',quote(trim(filename)),',',quote(cats(filename,'.fixed')),')'));
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 12 Sep 2022 23:05:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/833017#M329298</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-09-12T23:05:13Z</dc:date>
    </item>
    <item>
      <title>Re: Input a CSV file with text fields that contain line breaks + carriage returns and ',' signs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/833096#M329321</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp; ,&lt;/P&gt;
&lt;P&gt;It seems that your macro ONLY can handle the '0D0A'&amp;nbsp; in the quote,but what if they are not in quote(like the following picture) ?&lt;/P&gt;
&lt;P&gt;I run your macro and get ERROR. but mine don't.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1663071194625.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75184i7951C48DCDA748B9/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1663071194625.png" alt="Ksharp_0-1663071194625.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_1-1663071253194.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75185iD8AA8CB916340F17/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_1-1663071253194.png" alt="Ksharp_1-1663071253194.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2022 12:14:46 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/833096#M329321</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-09-13T12:14:46Z</dc:date>
    </item>
    <item>
      <title>Re: Input a CSV file with text fields that contain line breaks + carriage returns and ',' signs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/833098#M329322</link>
      <description>&lt;P&gt;Ha, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I run your code by Unicode SAS and get no ERROR,but get wrong result !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1663071540298.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75186iE09D414C57501E52/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1663071540298.png" alt="Ksharp_0-1663071540298.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2022 12:18:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/833098#M329322</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-09-13T12:18:49Z</dc:date>
    </item>
    <item>
      <title>Re: Input a CSV file with text fields that contain line breaks + carriage returns and ',' signs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/833108#M329326</link>
      <description>&lt;P&gt;Yes.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If the line breaks are not in quotes deciding whether or not there are extra line breaks is an impossible task.&lt;/P&gt;
&lt;P&gt;You can make it work if you make other assumptions about the file.&amp;nbsp; Things like, the delimiter will never appear as part of the data.&amp;nbsp; The extra line breaks will appear in only specific field(s).&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2022 12:51:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/833108#M329326</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-09-13T12:51:53Z</dc:date>
    </item>
    <item>
      <title>Re: Input a CSV file with text fields that contain line breaks + carriage returns and ',' signs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/833109#M329327</link>
      <description>&lt;P&gt;Post an minimal reproducible example file and we can look at it.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2022 12:53:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/833109#M329327</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-09-13T12:53:05Z</dc:date>
    </item>
    <item>
      <title>Re: Input a CSV file with text fields that contain line breaks + carriage returns and ',' signs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/833116#M329329</link>
      <description>&lt;P&gt;Sure. Here is . I modify it at line 7 and 8 as showed in my picture above.&lt;/P&gt;
&lt;P&gt;My code could get right result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2022 12:59:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/833116#M329329</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-09-13T12:59:23Z</dc:date>
    </item>
    <item>
      <title>Re: Input a CSV file with text fields that contain line breaks + carriage returns and ',' signs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/833161#M329343</link>
      <description>&lt;P&gt;How is a file with almost 30,000 lines MINIMAL?&lt;/P&gt;
&lt;PRE&gt;NOTE: 29960 records were read from the infile 'c:\downloads\have.csv'.
The minimum record length was 0.
The maximum record length was 6546.&lt;/PRE&gt;
&lt;P&gt;The issue has nothing to do with UTF-8 support.&lt;/P&gt;
&lt;P&gt;That file has a linefeed in the middle of the unquoted word english.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2022 14:42:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/833161#M329343</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-09-13T14:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: Input a CSV file with text fields that contain line breaks + carriage returns and ',' signs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/833313#M329410</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;“The issue has nothing to do with UTF-8 support.”&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I mean SAS LOG didn't show any ERROR info, therefore I am supposed to import correctly. However, I get wrong/screw result. as the following pictures showed:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_0-1663156219125.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75224i1C8F848F3162E7E0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_0-1663156219125.png" alt="Ksharp_0-1663156219125.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Ksharp_1-1663156233480.png" style="width: 400px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/75225iA2AAD536AA7A8740/image-size/medium?v=v2&amp;amp;px=400" role="button" title="Ksharp_1-1663156233480.png" alt="Ksharp_1-1663156233480.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2022 11:50:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/833313#M329410</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2022-09-14T11:50:21Z</dc:date>
    </item>
    <item>
      <title>Re: Input a CSV file with text fields that contain line breaks + carriage returns and ',' signs</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/833315#M329412</link>
      <description>&lt;P&gt;If the CSV file is not validly constructed then any attempt to read it is going to have problems.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The macro you are asking about is designed to remove linefeeds or carriage returns that are inside of quoted strings.&amp;nbsp; The file you provided has (at least) an extra linefeed inside of a string that is not quoted.&amp;nbsp; The word english that you circled in red in one of your photographs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if you want to fix that file you will need to use a different algorithm. Or just fix it manually using a text editor.&lt;/P&gt;</description>
      <pubDate>Wed, 14 Sep 2022 11:57:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Input-a-CSV-file-with-text-fields-that-contain-line-breaks/m-p/833315#M329412</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2022-09-14T11:57:18Z</dc:date>
    </item>
  </channel>
</rss>

