<?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: Special character in CSV causes SAS to skip over comma separator in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Special-character-in-CSV-causes-SAS-to-skip-over-comma-separator/m-p/439176#M109559</link>
    <description>&lt;P&gt;Maybe you need add ENCODING= option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token statement"&gt;infile&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;"[[filepath]]\test.csv"&lt;/SPAN&gt;&lt;/CODE&gt; encoding='utf8' ..............&lt;/PRE&gt;</description>
    <pubDate>Thu, 22 Feb 2018 06:11:10 GMT</pubDate>
    <dc:creator>Ksharp</dc:creator>
    <dc:date>2018-02-22T06:11:10Z</dc:date>
    <item>
      <title>Special character in CSV causes SAS to skip over comma separator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Special-character-in-CSV-causes-SAS-to-skip-over-comma-separator/m-p/438771#M109427</link>
      <description>&lt;P&gt;I'm importing a&amp;nbsp;CSV file&amp;nbsp;into SAS using INFILE / INPUT, but a special character is causing SAS to skip over the comma delimiter. Previous posts have suggested that I use SAS with Unicode Support, but I still run into the problem. I'm using SAS 9.4 with Unicode Support. My data looks something like this:&lt;/P&gt;&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;bill_address1&lt;/TD&gt;&lt;TD&gt;bill_address2&lt;/TD&gt;&lt;TD&gt;bill_address3&lt;/TD&gt;&lt;TD&gt;bill_address4&lt;/TD&gt;&lt;TD&gt;bill_address5&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;CS&lt;/TD&gt;&lt;TD&gt;GravÚ&lt;/TD&gt;&lt;TD&gt;90050&lt;/TD&gt;&lt;TD&gt;&amp;nbsp;Honfleur&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;9403&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;But when I&amp;nbsp;import the data with my code, SAS ignores the comma separator between bill_address2 and bill_address3:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 490px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18715i8A9B28591AE53DB0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The log file didn't output any errors or warnings. My code is below (replacing "[[filepath]]" with the data location)&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
	infile "[[filepath]]\test.csv"
	dsd missover lrecl = 32767 firstobs = 2;
	informat
		bill_address1 $2.
		bill_address2 $12.
		bill_address3 $12.
		bill_address4 $12.
		bill_address5 $12.
	;
	input
		bill_address1 $
		bill_address2 $
		bill_address3 $
		bill_address4 $
		bill_address5 $
	;
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 20 Feb 2018 20:07:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Special-character-in-CSV-causes-SAS-to-skip-over-comma-separator/m-p/438771#M109427</guid>
      <dc:creator>tluoskr</dc:creator>
      <dc:date>2018-02-20T20:07:44Z</dc:date>
    </item>
    <item>
      <title>Re: Special character in CSV causes SAS to skip over comma separator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Special-character-in-CSV-causes-SAS-to-skip-over-comma-separator/m-p/438781#M109433</link>
      <description>&lt;P&gt;try dlm =','&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2018 20:29:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Special-character-in-CSV-causes-SAS-to-skip-over-comma-separator/m-p/438781#M109433</guid>
      <dc:creator>kiranv_</dc:creator>
      <dc:date>2018-02-20T20:29:14Z</dc:date>
    </item>
    <item>
      <title>Re: Special character in CSV causes SAS to skip over comma separator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Special-character-in-CSV-causes-SAS-to-skip-over-comma-separator/m-p/438784#M109434</link>
      <description>&lt;P&gt;I tried replacing dsd with dlm = ",", but&amp;nbsp;I still have the same problem.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2018 20:33:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Special-character-in-CSV-causes-SAS-to-skip-over-comma-separator/m-p/438784#M109434</guid>
      <dc:creator>tluoskr</dc:creator>
      <dc:date>2018-02-20T20:33:27Z</dc:date>
    </item>
    <item>
      <title>Re: Special character in CSV causes SAS to skip over comma separator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Special-character-in-CSV-causes-SAS-to-skip-over-comma-separator/m-p/438789#M109436</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/37783"&gt;@kiranv_&lt;/a&gt;&amp;nbsp;DSD implies DLM.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/115018"&gt;@tluoskr&lt;/a&gt;&amp;nbsp;View your file with a text editor (hex format) to determine what that special character is, once you know what the character is, you can strip it out with TRANSLATE or COMPRESS. I suspect it's a carriage return, especially if your data was in Excel at some point and someone had formatted the data using ALT+ENTER. If that's the case there are two solutions from the past week on this question posted on the forum.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/115018"&gt;@tluoskr&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;I'm importing a&amp;nbsp;CSV file&amp;nbsp;into SAS using INFILE / INPUT, but a special character is causing SAS to skip over the comma delimiter. Previous posts have suggested that I use SAS with Unicode Support, but I still run into the problem. I'm using SAS 9.4 with Unicode Support. My data looks something like this:&lt;/P&gt;
&lt;TABLE border="0" cellspacing="0" cellpadding="0"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD&gt;bill_address1&lt;/TD&gt;
&lt;TD&gt;bill_address2&lt;/TD&gt;
&lt;TD&gt;bill_address3&lt;/TD&gt;
&lt;TD&gt;bill_address4&lt;/TD&gt;
&lt;TD&gt;bill_address5&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD&gt;CS&lt;/TD&gt;
&lt;TD&gt;GravÚ&lt;/TD&gt;
&lt;TD&gt;90050&lt;/TD&gt;
&lt;TD&gt;&amp;nbsp;Honfleur&amp;nbsp;&lt;/TD&gt;
&lt;TD&gt;9403&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But when I&amp;nbsp;import the data with my code, SAS ignores the comma separator between bill_address2 and bill_address3:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.PNG" style="width: 490px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18715i8A9B28591AE53DB0/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.PNG" alt="Capture.PNG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The log file didn't output any errors or warnings. My code is below (replacing "[[filepath]]" with the data location)&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test;
	infile "[[filepath]]\test.csv"
	dsd missover lrecl = 32767 firstobs = 2;
	informat
		bill_address1 $2.
		bill_address2 $12.
		bill_address3 $12.
		bill_address4 $12.
		bill_address5 $12.
	;
	input
		bill_address1 $
		bill_address2 $
		bill_address3 $
		bill_address4 $
		bill_address5 $
	;
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2018 20:38:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Special-character-in-CSV-causes-SAS-to-skip-over-comma-separator/m-p/438789#M109436</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-02-20T20:38:09Z</dc:date>
    </item>
    <item>
      <title>Re: Special character in CSV causes SAS to skip over comma separator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Special-character-in-CSV-causes-SAS-to-skip-over-comma-separator/m-p/438810#M109451</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/115018"&gt;@tluoskr&lt;/a&gt;&lt;/P&gt;
&lt;P&gt;Using the data and code you've posted I can't replicate the issue you describe but get the desired result.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture.JPG" style="width: 490px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/18720i217930DF5886EC65/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture.JPG" alt="Capture.JPG" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you please try and post some data which allows us to replicate the issue.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As already suggested by others: Use a text editor like Notepad++ which allows you to make all characters visible and search for something unusual in the data.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Feb 2018 21:31:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Special-character-in-CSV-causes-SAS-to-skip-over-comma-separator/m-p/438810#M109451</guid>
      <dc:creator>Patrick</dc:creator>
      <dc:date>2018-02-20T21:31:43Z</dc:date>
    </item>
    <item>
      <title>Re: Special character in CSV causes SAS to skip over comma separator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Special-character-in-CSV-causes-SAS-to-skip-over-comma-separator/m-p/439176#M109559</link>
      <description>&lt;P&gt;Maybe you need add ENCODING= option.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE class=" language-sas"&gt;&lt;CODE class="  language-sas"&gt;&lt;SPAN class="token statement"&gt;infile&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;"[[filepath]]\test.csv"&lt;/SPAN&gt;&lt;/CODE&gt; encoding='utf8' ..............&lt;/PRE&gt;</description>
      <pubDate>Thu, 22 Feb 2018 06:11:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Special-character-in-CSV-causes-SAS-to-skip-over-comma-separator/m-p/439176#M109559</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-02-22T06:11:10Z</dc:date>
    </item>
    <item>
      <title>Re: Special character in CSV causes SAS to skip over comma separator</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Special-character-in-CSV-causes-SAS-to-skip-over-comma-separator/m-p/537449#M147817</link>
      <description>&lt;P&gt;You are right the encoding option works.&lt;/P&gt;&lt;P&gt;encoding in the infile statement should match the source(where the csv is prepared) encoding.&lt;/P&gt;&lt;P&gt;target SAS environment has to be&amp;nbsp;set to UTF8.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;wlatin1 is&amp;nbsp; one of the encodings used by WIndows systems.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;example:&lt;/P&gt;&lt;P&gt;&lt;SPAN class="token statement"&gt;infile&lt;/SPAN&gt; &lt;SPAN class="token string"&gt;"[[filepath]]\test.csv"&lt;/SPAN&gt; encoding='wlatin1'&lt;/P&gt;</description>
      <pubDate>Thu, 21 Feb 2019 16:32:15 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Special-character-in-CSV-causes-SAS-to-skip-over-comma-separator/m-p/537449#M147817</guid>
      <dc:creator>Na_vin</dc:creator>
      <dc:date>2019-02-21T16:32:15Z</dc:date>
    </item>
  </channel>
</rss>

