<?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: Remove single or double quotes around values in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Remove-single-or-double-quotes-around-values/m-p/490555#M128363</link>
    <description>&lt;P&gt;How are you reading the values from Excel?&amp;nbsp; Are you using PROC IMPORT?&amp;nbsp; The XLSX libname engine? Dumping the file to a CSV file and then reading that file?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are reading the data from a CSV (or other delimited text file) then using the DSD option on the INFILE statement will automatically remove the quotes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise use the DEQUOTE() function.&lt;/P&gt;</description>
    <pubDate>Tue, 28 Aug 2018 16:43:13 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2018-08-28T16:43:13Z</dc:date>
    <item>
      <title>Remove single or double quotes around values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-single-or-double-quotes-around-values/m-p/490552#M128361</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A variable has below values coming from excel and SAS datasets will have the values as below&lt;/P&gt;&lt;P&gt;Credit&lt;/P&gt;&lt;P&gt;Debit&lt;/P&gt;&lt;P&gt;"No Value"&lt;/P&gt;&lt;P&gt;'No Value'&lt;/P&gt;&lt;P&gt;" "&lt;/P&gt;&lt;P&gt;' '&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the above test data, how to convert "No Value", 'No Value', " ", ' ' to without quotes as below. Two empty rows will be there in the last two records.&lt;/P&gt;&lt;P&gt;Credit&lt;/P&gt;&lt;P&gt;Debit&lt;/P&gt;&lt;P&gt;No Value&lt;/P&gt;&lt;P&gt;No Value&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, 28 Aug 2018 16:35:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-single-or-double-quotes-around-values/m-p/490552#M128361</guid>
      <dc:creator>SASPhile</dc:creator>
      <dc:date>2018-08-28T16:35:44Z</dc:date>
    </item>
    <item>
      <title>Re: Remove single or double quotes around values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-single-or-double-quotes-around-values/m-p/490554#M128362</link>
      <description>&lt;P&gt;DEQUOTE() function.&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/16600"&gt;@SASPhile&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;A variable has below values coming from excel and SAS datasets will have the values as below&lt;/P&gt;
&lt;P&gt;Credit&lt;/P&gt;
&lt;P&gt;Debit&lt;/P&gt;
&lt;P&gt;"No Value"&lt;/P&gt;
&lt;P&gt;'No Value'&lt;/P&gt;
&lt;P&gt;" "&lt;/P&gt;
&lt;P&gt;' '&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the above test data, how to convert "No Value", 'No Value', " ", ' ' to without quotes as below. Two empty rows will be there in the last two records.&lt;/P&gt;
&lt;P&gt;Credit&lt;/P&gt;
&lt;P&gt;Debit&lt;/P&gt;
&lt;P&gt;No Value&lt;/P&gt;
&lt;P&gt;No Value&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;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 16:42:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-single-or-double-quotes-around-values/m-p/490554#M128362</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2018-08-28T16:42:34Z</dc:date>
    </item>
    <item>
      <title>Re: Remove single or double quotes around values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-single-or-double-quotes-around-values/m-p/490555#M128363</link>
      <description>&lt;P&gt;How are you reading the values from Excel?&amp;nbsp; Are you using PROC IMPORT?&amp;nbsp; The XLSX libname engine? Dumping the file to a CSV file and then reading that file?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you are reading the data from a CSV (or other delimited text file) then using the DSD option on the INFILE statement will automatically remove the quotes.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise use the DEQUOTE() function.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2018 16:43:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-single-or-double-quotes-around-values/m-p/490555#M128363</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-08-28T16:43:13Z</dc:date>
    </item>
    <item>
      <title>Re: Remove single or double quotes around values</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Remove-single-or-double-quotes-around-values/m-p/686369#M208259</link>
      <description>&lt;P&gt;I would caution about using DEQUOTE() function since it does not exactly remove "surrounding" quotes. According to the &lt;A href="https://go.documentation.sas.com/?docsetId=lefunctionsref&amp;amp;docsetTarget=n0v1da94165bxen1oj003r1vx2m4.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;documentation for DEQUOTE function&lt;/A&gt; it "Removes matching quotation marks from a character string that begins with a quotation mark, &lt;STRONG&gt;and deletes all characters to the right of the closing quotation mark&lt;/STRONG&gt;."&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That means that if your character string begins with a quotation mark and has the same quotation mark somewhere inside it's value, the DEQUOTE function will strip all the characters after that "internal" quotation mark.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try running the following code:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data A;
   length c $40;
   input c $char40.;
   c1 = dequote(c);
   put c1=;
   datalines;
'Some' value'
;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It will produce the following in the SAS log:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;c1=Some
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;That is you will lose information (word &lt;STRONG&gt;&lt;FONT face="courier new,courier" size="4"&gt;value&lt;/FONT&gt;&lt;/STRONG&gt; is lost).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;FONT size="4" color="#FF9900"&gt;&lt;STRONG&gt;UNQUOTE() Function&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;To prevent such information loss I developed and implemented a user-defined function UNQUOTE that does exactly what was asked in this question - &lt;STRONG&gt;remove matching single or double quotes surrounding character value&lt;/STRONG&gt;.&amp;nbsp; You can find the UNQUOTE() function implementation code along with a detail review of other quoting and unquoting issues in the following blog post&amp;nbsp;&lt;A href="https://blogs.sas.com/content/sgf/2020/09/17/how-to-unquote-sas-character-variable-values/" target="_self"&gt;How to unquote SAS character variable values&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Sep 2020 13:34:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Remove-single-or-double-quotes-around-values/m-p/686369#M208259</guid>
      <dc:creator>LeonidBatkhan</dc:creator>
      <dc:date>2020-09-24T13:34:14Z</dc:date>
    </item>
  </channel>
</rss>

