<?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: Clarification on file delimiter when there is a extra comma in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Clarification-on-file-delimiter-when-there-is-a-extra-comma/m-p/372676#M89143</link>
    <description>&lt;P&gt;Thank You for your response. Let me try andreas_ids&lt;SPAN class="login-bold"&gt;&amp;nbsp;given solution to resolve this issue.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 03 Jul 2017 08:57:39 GMT</pubDate>
    <dc:creator>Fathima</dc:creator>
    <dc:date>2017-07-03T08:57:39Z</dc:date>
    <item>
      <title>Clarification on file delimiter when there is a extra comma</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Clarification-on-file-delimiter-when-there-is-a-extra-comma/m-p/372664#M89134</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to write a SAS which is 'Comma' separated file and not properly alligned. In third &amp;amp; fifith records (or lines) there is a extra comma in the City (&lt;SPAN&gt;Ma,dison&lt;/SPAN&gt;&lt;SPAN&gt;&amp;nbsp;&amp;amp; flo,rida&lt;/SPAN&gt;&lt;SPAN&gt;).&amp;nbsp;&lt;/SPAN&gt;&amp;nbsp;When i execute the below code, under 'GENDER' &amp;nbsp;city name '&lt;SPAN&gt;dison' &amp;amp; 'rida'&amp;nbsp;&lt;/SPAN&gt;values getting updated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can anyone please help me how to write the code to get the correct values under correct column?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;data address2;&lt;BR /&gt;infile datalines dsd;&lt;BR /&gt;length city $10;&lt;BR /&gt;input name $ age city $ gender $;&lt;BR /&gt;datalines;&lt;BR /&gt;Steve,32,Monona,M&lt;BR /&gt;Tom,44,Milwaukee,M&lt;BR /&gt;Deb,23,Ma,dison,F&lt;BR /&gt;bob,24,Texas,M&lt;BR /&gt;Harry,43,flo,rida,M&lt;BR /&gt;run;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2017 07:40:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Clarification-on-file-delimiter-when-there-is-a-extra-comma/m-p/372664#M89134</guid>
      <dc:creator>Fathima</dc:creator>
      <dc:date>2017-07-03T07:40:45Z</dc:date>
    </item>
    <item>
      <title>Re: Clarification on file delimiter when there is a extra comma</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Clarification-on-file-delimiter-when-there-is-a-extra-comma/m-p/372665#M89135</link>
      <description>Does your source data look like this?&lt;BR /&gt;If so (that values themselves contain the delimiter), either ask for a file with a different delimter, or have sll char values enclosed between " signs.&lt;BR /&gt;Or, have the source fix the obvious data quality issues...</description>
      <pubDate>Mon, 03 Jul 2017 07:50:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Clarification-on-file-delimiter-when-there-is-a-extra-comma/m-p/372665#M89135</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2017-07-03T07:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: Clarification on file delimiter when there is a extra comma</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Clarification-on-file-delimiter-when-there-is-a-extra-comma/m-p/372667#M89137</link>
      <description>&lt;P&gt;Per standard CSV definition, if a column of data contains the delimiter comma, then that whole column of data needs to be enclosed within enough quote marks to ensure the comma within the text is not recognised as a delimiter of the data. &amp;nbsp;Typically this only needs one quote each end:&lt;BR /&gt;&lt;SPAN&gt;Harry,43,"flo,rida",M&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2017 07:55:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Clarification-on-file-delimiter-when-there-is-a-extra-comma/m-p/372667#M89137</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2017-07-03T07:55:26Z</dc:date>
    </item>
    <item>
      <title>Re: Clarification on file delimiter when there is a extra comma</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Clarification-on-file-delimiter-when-there-is-a-extra-comma/m-p/372670#M89139</link>
      <description>&lt;P&gt;Following the advice provided by &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13674"&gt;@LinusH&lt;/a&gt; and &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/45151"&gt;@RW9&lt;/a&gt; is highly recommended.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you can't get a fixed source file, try the following code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data address2;
infile datalines dsd;
length city $10;
input name $ age city $ gender $;

if countc(_infile_, ',') &amp;gt; 3 then do;
   gender = scan(_infile_, 1, ',', 'b');
   call scan(_infile_, 3, pos, len, ',');
   city = compress(substr(_infile_, pos, findc(_infile_, ',', 'b')-pos), ',');
end;

datalines;
Steve,32,Monona,M
Tom,44,Milwaukee,M
Deb,23,Ma,dison,F
bob,24,Texas,M
Harry,43,flo,rida,M
run;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Jul 2017 08:08:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Clarification-on-file-delimiter-when-there-is-a-extra-comma/m-p/372670#M89139</guid>
      <dc:creator>andreas_lds</dc:creator>
      <dc:date>2017-07-03T08:08:33Z</dc:date>
    </item>
    <item>
      <title>Re: Clarification on file delimiter when there is a extra comma</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Clarification-on-file-delimiter-when-there-is-a-extra-comma/m-p/372676#M89143</link>
      <description>&lt;P&gt;Thank You for your response. Let me try andreas_ids&lt;SPAN class="login-bold"&gt;&amp;nbsp;given solution to resolve this issue.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2017 08:57:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Clarification-on-file-delimiter-when-there-is-a-extra-comma/m-p/372676#M89143</guid>
      <dc:creator>Fathima</dc:creator>
      <dc:date>2017-07-03T08:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: Clarification on file delimiter when there is a extra comma</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Clarification-on-file-delimiter-when-there-is-a-extra-comma/m-p/372677#M89144</link>
      <description>Thanks for your response!</description>
      <pubDate>Mon, 03 Jul 2017 08:58:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Clarification-on-file-delimiter-when-there-is-a-extra-comma/m-p/372677#M89144</guid>
      <dc:creator>Fathima</dc:creator>
      <dc:date>2017-07-03T08:58:23Z</dc:date>
    </item>
    <item>
      <title>Re: Clarification on file delimiter when there is a extra comma</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Clarification-on-file-delimiter-when-there-is-a-extra-comma/m-p/372680#M89147</link>
      <description>&lt;P&gt;Thank You so much andreas_ids ! it worked!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Obs CITY NAME AGE GENDER POS LEN&lt;/P&gt;&lt;P&gt;1 MONONA STEVE 32 M . .&lt;BR /&gt;2 MILWAUKEE TOM 44 M . .&lt;BR /&gt;3 MADISON DEB 23 F 8 2&lt;BR /&gt;4 TEXAS BOB 24 M . .&lt;BR /&gt;5 FLORIDA HARRY 43 M 10 3&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 03 Jul 2017 09:16:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Clarification-on-file-delimiter-when-there-is-a-extra-comma/m-p/372680#M89147</guid>
      <dc:creator>Fathima</dc:creator>
      <dc:date>2017-07-03T09:16:29Z</dc:date>
    </item>
  </channel>
</rss>

