<?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: Import data with unexpected split lines in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368550#M87909</link>
    <description>&lt;P&gt;Most likely&amp;nbsp;EG is on the server and the file is on your local drive.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To see 'non-printable' characters you need to use a decent text editor, ie NotePad++ or TextWranger are the two that I use.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 20 Jun 2017 01:18:26 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2017-06-20T01:18:26Z</dc:date>
    <item>
      <title>Import data with unexpected split lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368139#M87763</link>
      <description>&lt;P&gt;I got a datasets with some cells contain multiple lines. Like row3 under SrreComm column, there are two lines (see picture below. When importing the data, sas will automatically read this one cell as 2 records. I tried to use&amp;nbsp;TERMSTR=CRLF but did not work. Anyone know how to deal with it?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Andrea&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;My codes:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data WORK.TUMOUR2 ;&lt;BR /&gt;%let _EFIERR_ = 0;&lt;BR /&gt;infile '&amp;amp;dir2.\&amp;amp;foldername.\tumour_noclass_MA.csv' delimiter = ',' MISSOVER DSD lrecl=32767 firstobs=2 TERMSTR=CRLF;&lt;BR /&gt;informat DDtlODsc $89. ;&lt;BR /&gt;informat SrceComm $255. ;&lt;BR /&gt;informat COUNT best12.;&lt;BR /&gt;informat tumour_type $9. ;&lt;BR /&gt;informat indicator_type $10. ;&lt;BR /&gt;informat MA best12. ;&lt;BR /&gt;format DDtlODsc $89. ;&lt;BR /&gt;format SrceComm $255. ;&lt;BR /&gt;format COUNT best12. ;&lt;BR /&gt;format tumour_type $9. ;&lt;BR /&gt;format indicator_type $10. ;&lt;BR /&gt;format MA best12. ;&lt;BR /&gt;input DDtlODsc $ SrceComm $ COUNT tumour_type $ indicator_type $ MA;&lt;BR /&gt;if _ERROR_ then call symputx('_EFIERR_',1);&lt;BR /&gt;run;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/9471iCE90E81888264F26/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="Capture.JPG" title="Capture.JPG" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 02:07:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368139#M87763</guid>
      <dc:creator>Andrea_Peng</dc:creator>
      <dc:date>2017-06-19T02:07:35Z</dc:date>
    </item>
    <item>
      <title>Re: Import data with unexpected split lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368143#M87764</link>
      <description>&lt;P&gt;What happens if you remove the MISSOVER, should be TRUNCOVER anyways and DSD.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Usually this gets read in properly in my experience, but I'm assuming you created this CSV from Excel for some reason?&lt;/P&gt;
&lt;P&gt;Are you sure that comment field doesn't have comma's in it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 02:45:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368143#M87764</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-06-19T02:45:06Z</dc:date>
    </item>
    <item>
      <title>Re: Import data with unexpected split lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368151#M87766</link>
      <description>&lt;P&gt;Hi Reeza,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes. The data comes from an excel file, which was from SAS! Some cells do have cooma but the major problem seems like coming from the split lines instead of comma. Not quite understand the reason. I swap missover to truncover now and put ignoredoseof. Get nothing! And no error in the log.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Andrea&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 04:25:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368151#M87766</guid>
      <dc:creator>Andrea_Peng</dc:creator>
      <dc:date>2017-06-19T04:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: Import data with unexpected split lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368152#M87767</link>
      <description>&lt;P&gt;Did you figure out the character that's causing the issue?&lt;/P&gt;
&lt;P&gt;Is it&amp;nbsp;&lt;/P&gt;
&lt;P&gt;'041'x?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 04:30:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368152#M87767</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-06-19T04:30:53Z</dc:date>
    </item>
    <item>
      <title>Re: Import data with unexpected split lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368153#M87768</link>
      <description>&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Data-Management/Special-Carriages/m-p/214770/highlight/true#M5143" target="_blank"&gt;https://communities.sas.com/t5/SAS-Data-Management/Special-Carriages/m-p/214770/highlight/true#M5143&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 04:50:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368153#M87768</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-06-19T04:50:03Z</dc:date>
    </item>
    <item>
      <title>Re: Import data with unexpected split lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368193#M87781</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To read a file that has LF,&amp;nbsp; x"0a" as part of their data value, you can use the option TERMSTR=CRLF, this was alread metioned.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are using SAS Enterprise Guide, by default you will not see the text that comes after the LF. Better do a Proc PRINT from your data.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The following code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;filename xcsv "c:\temp\sample.csv" termstr=crlf;
proc import file=xcsv out=want dbms=csv replace ;
run;
proc print data=want;
run;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Will read a file that looks like this:&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/9472i1D6A5BDF8132BEBB/image-size/original?v=1.0&amp;amp;px=-1" alt="Snap8.png" title="Snap8.png" border="0" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jun 2017 08:16:42 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368193#M87781</guid>
      <dc:creator>BrunoMueller</dc:creator>
      <dc:date>2017-06-19T08:16:42Z</dc:date>
    </item>
    <item>
      <title>Re: Import data with unexpected split lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368536#M87903</link>
      <description>&lt;P&gt;Hi Reeze,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use notepad to look at the data, finding there is a quote when data is split into 2 lines. I suspect it is the quote but not sure, I will have a try.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;IMG src="https://communities.sas.com/t5/image/serverpage/image-id/9517i6EEEF5D42529FC44/image-size/original?v=1.0&amp;amp;px=-1" border="0" alt="Capture.JPG" title="Capture.JPG" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Andrea&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 00:07:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368536#M87903</guid>
      <dc:creator>Andrea_Peng</dc:creator>
      <dc:date>2017-06-20T00:07:23Z</dc:date>
    </item>
    <item>
      <title>Re: Import data with unexpected split lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368541#M87904</link>
      <description>&lt;P&gt;Notepad is useless for this as it doesn't display non-printable characters.&lt;/P&gt;
&lt;P&gt;You need to identify what character is causing the issue.&lt;/P&gt;
&lt;P&gt;Run this&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data TEST3;
  infile "&amp;amp;dir2.\&amp;amp;foldername.\tumour_noclass_MA.csv" recfm=n;
  input X $1. @@;
  putlog X $1. @3 X $hex2.;
run; &lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It will print one line par character in the log, together with its hexadecimal code.&lt;/P&gt;
&lt;P&gt;Look after 133,,, see what&amp;nbsp;you have.&lt;/P&gt;
&lt;P&gt;Regardless, you&amp;nbsp;should clean your data *before* you export it to CSV, and remove non-printable characters from strings if they are unneeded, like this:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;STRING=compress(STRING,,'wk');&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;Non-printable characters will always mess up CSV files.&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, 20 Jun 2017 00:37:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368541#M87904</guid>
      <dc:creator>ChrisNZ</dc:creator>
      <dc:date>2017-06-20T00:37:06Z</dc:date>
    </item>
    <item>
      <title>Re: Import data with unexpected split lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368543#M87906</link>
      <description>&lt;P&gt;Hi Bruno,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;An exellent idea! But SAS Enterprise Guide seems can't find the file. I will have a look the problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Andrea&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 00:43:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368543#M87906</guid>
      <dc:creator>Andrea_Peng</dc:creator>
      <dc:date>2017-06-20T00:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: Import data with unexpected split lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368550#M87909</link>
      <description>&lt;P&gt;Most likely&amp;nbsp;EG is on the server and the file is on your local drive.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To see 'non-printable' characters you need to use a decent text editor, ie NotePad++ or TextWranger are the two that I use.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 01:18:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368550#M87909</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2017-06-20T01:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: Import data with unexpected split lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368551#M87910</link>
      <description>&lt;P&gt;Hi Chris,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just removed the non-printable characters and exported the file again! It works well now!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Andrea&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 01:23:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368551#M87910</guid>
      <dc:creator>Andrea_Peng</dc:creator>
      <dc:date>2017-06-20T01:23:15Z</dc:date>
    </item>
    <item>
      <title>Re: Import data with unexpected split lines</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368552#M87911</link>
      <description>&lt;P&gt;Hi Reeze,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I just used Chris's idea, remove the non-printable characters and exported the file again! It is sovled!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for all you guys suggestions!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;Andrea&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jun 2017 01:25:04 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Import-data-with-unexpected-split-lines/m-p/368552#M87911</guid>
      <dc:creator>Andrea_Peng</dc:creator>
      <dc:date>2017-06-20T01:25:04Z</dc:date>
    </item>
  </channel>
</rss>

