<?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: Ignoring comma within quotes - Reading CSV in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Ignoring-comma-within-quotes-Reading-CSV/m-p/247823#M46476</link>
    <description>&lt;P&gt;It looks like your issue may be reading only part of the line and not finding the ending quote begining at &lt;STRONG&gt;"Bda Caban, Bd&lt;/STRONG&gt;a Esteves&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Possibly you need to add &amp;nbsp;LRECL=10000 (or some other number large enough to hold the longest line in your data) to your INFILE statement to read the entire line.&lt;/P&gt;</description>
    <pubDate>Wed, 03 Feb 2016 19:08:13 GMT</pubDate>
    <dc:creator>ballardw</dc:creator>
    <dc:date>2016-02-03T19:08:13Z</dc:date>
    <item>
      <title>Ignoring comma within quotes - Reading CSV</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Ignoring-comma-within-quotes-Reading-CSV/m-p/247816#M46474</link>
      <description>&lt;P&gt;I am trying to read a CSV file with commas within quotes, but my code is not reading it correctly. One of the articles suggested that if I removed the DLM="," option, it should work but it didn't do the trick.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Below is the my log (includes code and line with error). I have bolded the log to highlight the characters and fields where the error is occuring. I'd appreciate your help with this.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;14683&amp;nbsp; data ZipCode_to_City;&lt;BR /&gt;14684 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;%let _EFIERR_ = 0; /* set the ERROR detection macro variable */&lt;BR /&gt;14685 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;SYMBOLGEN:&amp;nbsp; Macro variable BASE_DIR_PATH resolves to /export/appl/ao1_data1_r/MAPD&lt;BR /&gt;SYMBOLGEN:&amp;nbsp; Macro variable BOOKING_MONTH resolves to Dec2015&lt;BR /&gt;14685!&amp;nbsp; infile "&amp;amp;base_dir_path./Input/&amp;amp;booking_month./MapBook/zip_code_database.csv" dsd missover firstobs=2;&lt;BR /&gt;14686 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;input&lt;BR /&gt;14687 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;zipcpde : $5.&lt;BR /&gt;14688 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;type : $10.&lt;BR /&gt;14689 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;City : $30.&lt;BR /&gt;14690 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;acceptable_cities : $100.&lt;BR /&gt;14691 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;unacceptable_cities : $100.&lt;BR /&gt;14692 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;state : $2.&lt;BR /&gt;14693 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;county : $30.&lt;BR /&gt;14694 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;timezone : $30.&lt;BR /&gt;14695 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;area_codes : $30.&lt;BR /&gt;14696 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;latitude : comma.&lt;BR /&gt;14697 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;longitude : comma.&lt;BR /&gt;14698 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;world_region : $20.&lt;BR /&gt;14699 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;country_code : $2.&lt;BR /&gt;14700 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;decommissioned : comma.&lt;BR /&gt;14701 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;estimated_population : comma.&lt;BR /&gt;14702 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;notes : $50.&lt;BR /&gt;14703 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;dummy :$1.&lt;BR /&gt;14704 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;;&lt;BR /&gt;14705 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;if _ERROR_ then call symputx('_EFIERR_',1);&amp;nbsp; /* set ERROR detection macro variable */&lt;BR /&gt;14706 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;City = propcase( strip(City) );&lt;BR /&gt;14707 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;drop type acceptable_cities&amp;nbsp;&amp;nbsp; &amp;nbsp;unacceptable_cities&amp;nbsp;&amp;nbsp; &amp;nbsp;state county_code timezone area_codes&lt;BR /&gt;14708 &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;latitude longitude world_region country decommissioned estimated_population&amp;nbsp;&amp;nbsp; &amp;nbsp;notes dummy;&lt;BR /&gt;14709&amp;nbsp; run;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;WARNING: The variable county_code in the DROP, KEEP, or RENAME list has never been referenced.&lt;BR /&gt;WARNING: The variable country in the DROP, KEEP, or RENAME list has never been referenced.&lt;BR /&gt;NOTE: The infile "/export/appl/ao1_data1_r/MAPD/Input/Dec2015/MapBook/zip_code_database.csv" is:&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Filename=/export/appl/ao1_data1_r/MAPD/Input/Dec2015/MapBook/zip_code_database.csv,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Owner Name=gauasr,Group Name=cchome091,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Access Permission=rw-rw----,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Last Modified=Wed Feb&amp;nbsp; 3 13:17:50 2016,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; File Size (bytes)=4568636&lt;BR /&gt;&lt;BR /&gt;NOTE: Invalid data for latitude in line 5 99-111.&lt;BR /&gt;NOTE: Invalid data for longitude in line 5 113-126.&lt;BR /&gt;NOTE: Invalid data for decommissioned in line 5 160-177.&lt;BR /&gt;NOTE: Invalid data for estimated_population in line 5 179-194.&lt;BR /&gt;RULE:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ----+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0&lt;BR /&gt;5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 00603,STANDARD,Aguadilla,Ramey,&lt;STRONG&gt;"Bda Caban, Bd&lt;/STRONG&gt;a Esteves, Bo Borinquen, Bo Ceiba Baja, Ext El Prado, E&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 101&amp;nbsp; xt Marbella, Repto Jimenez, Repto Juan Aguiar, Repto Lopez, Repto Tres Palmas, Sect Las Villas, Urb&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 201&amp;nbsp; Borinquen, Urb El Prado, Urb Esteves, Urb Garcia, Urb La&lt;BR /&gt;zipcpde=00603 type=STANDARD City=Aguadilla acceptable_cities=Ramey &lt;STRONG&gt;unacceptable_cities="Bda Caban state=Bd&lt;/STRONG&gt; county=Bo Borinquen&lt;BR /&gt;timezone=Bo Ceiba Baja area_codes=Ext El Prado latitude=. longitude=. world_region=Repto Juan Aguiar country_code=Re&lt;BR /&gt;decommissioned=. estimated_population=. notes=Urb Borinquen dummy=U _ERROR_=1 _N_=4&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2016 18:41:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Ignoring-comma-within-quotes-Reading-CSV/m-p/247816#M46474</guid>
      <dc:creator>asimraja</dc:creator>
      <dc:date>2016-02-03T18:41:55Z</dc:date>
    </item>
    <item>
      <title>Re: Ignoring comma within quotes - Reading CSV</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Ignoring-comma-within-quotes-Reading-CSV/m-p/247823#M46476</link>
      <description>&lt;P&gt;It looks like your issue may be reading only part of the line and not finding the ending quote begining at &lt;STRONG&gt;"Bda Caban, Bd&lt;/STRONG&gt;a Esteves&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Possibly you need to add &amp;nbsp;LRECL=10000 (or some other number large enough to hold the longest line in your data) to your INFILE statement to read the entire line.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2016 19:08:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Ignoring-comma-within-quotes-Reading-CSV/m-p/247823#M46476</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2016-02-03T19:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: Ignoring comma within quotes - Reading CSV</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Ignoring-comma-within-quotes-Reading-CSV/m-p/247824#M46477</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;
&lt;P&gt;&lt;BR /&gt;WARNING: The variable&lt;STRONG&gt;&lt;U&gt; county_code&lt;/U&gt;&lt;/STRONG&gt; in the DROP, KEEP, or RENAME list has never been referenced.&lt;BR /&gt;WARNING: The variable &lt;STRONG&gt;&lt;U&gt;country&lt;/U&gt;&lt;/STRONG&gt; in the DROP, KEEP, or RENAME list has never been referenced.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You typed your variables names wrong in the drop statment. They are country code and county not as you added. So you are getting two warnnings for that.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regarding adding or deleting the option&amp;nbsp;&lt;STRONG&gt;DELIMITER=',' .&amp;nbsp;&lt;/STRONG&gt;You do not have to add it if you used the option DSD as it by default deal with comma as delimiter. And it handle the comma within qoutes also.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Can you post the complete observation mentioned in the log&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;BR /&gt;5&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 00603,STANDARD,Aguadilla,Ramey,&lt;STRONG&gt;"Bda Caban, Bd&lt;/STRONG&gt;a Esteves, Bo Borinquen, Bo Ceiba Baja, Ext El Prado, E&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2016 19:13:38 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Ignoring-comma-within-quotes-Reading-CSV/m-p/247824#M46477</guid>
      <dc:creator>mohamed_zaki</dc:creator>
      <dc:date>2016-02-03T19:13:38Z</dc:date>
    </item>
    <item>
      <title>Re: Ignoring comma within quotes - Reading CSV</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Ignoring-comma-within-quotes-Reading-CSV/m-p/247825#M46478</link>
      <description>&lt;P&gt;Ballardw,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You are right. The LRECL option fixed it. Thank you very much!&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2016 19:12:17 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Ignoring-comma-within-quotes-Reading-CSV/m-p/247825#M46478</guid>
      <dc:creator>asimraja</dc:creator>
      <dc:date>2016-02-03T19:12:17Z</dc:date>
    </item>
    <item>
      <title>Re: Ignoring comma within quotes - Reading CSV</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Ignoring-comma-within-quotes-Reading-CSV/m-p/247826#M46479</link>
      <description>&lt;P&gt;mohamed_zaki,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you for pointing out the warnings! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; I fixed them.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'll make anote about the use of DSD with Delimiter option. As I replied earlier, LRECL option fixed it, as I was not reading the entire line.&lt;/P&gt;</description>
      <pubDate>Wed, 03 Feb 2016 19:13:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Ignoring-comma-within-quotes-Reading-CSV/m-p/247826#M46479</guid>
      <dc:creator>asimraja</dc:creator>
      <dc:date>2016-02-03T19:13:53Z</dc:date>
    </item>
  </channel>
</rss>

