<?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: %QUOTE in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/QUOTE/m-p/493088#M129699</link>
    <description>&lt;P&gt;Note that to the macro processor quotes are part of the value.&amp;nbsp; To the macro processor everything is just text so there is no need to add quotes around stings to help the parser figure out that the word is not meant as a number or variable name or keyword.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if your macro variable contains XXX and you compare it to "XXX" it will not match since one starts with X and the other with a double quote character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let email = fred.smith@company.org ;
...
%if &amp;amp;email = fred.smith@company.org %then %do;
%put Sending email to Fred ;
...
%end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 06 Sep 2018 16:07:24 GMT</pubDate>
    <dc:creator>Tom</dc:creator>
    <dc:date>2018-09-06T16:07:24Z</dc:date>
    <item>
      <title>%QUOTE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/QUOTE/m-p/493036#M129685</link>
      <description>&lt;P&gt;Can somebody much smarter than me help me understand what %QUOTE does? The online documentation says it "masks" a string. Does that mean it ignores things like a quoted string?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the line of code I'm trying to understand.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%IF &amp;amp;strInToLine NE %QUOTE(NONE) %THEN %DO;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've seen examples where the %QUOTE is used around the macro variable but not around a text like NONE.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 06 Sep 2018 14:40:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/QUOTE/m-p/493036#M129685</guid>
      <dc:creator>pchappus</dc:creator>
      <dc:date>2018-09-06T14:40:03Z</dc:date>
    </item>
    <item>
      <title>Re: %QUOTE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/QUOTE/m-p/493039#M129686</link>
      <description>&lt;P&gt;%QUOTE should be used on macro variables if they could possibly contain special characters that could cause confusion on the part of the macro processor. The documentation for %QUOTE indicates which characters are considered special&amp;nbsp; characters.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%QUOTE would never be used on just plain text, for example %QUOTE(NONE) is not appropriate use of %QUOTE.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Sep 2018 14:44:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/QUOTE/m-p/493039#M129686</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2018-09-06T14:44:59Z</dc:date>
    </item>
    <item>
      <title>Re: %QUOTE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/QUOTE/m-p/493042#M129688</link>
      <description>&lt;P&gt;Okay, I think I might need it around the marco variable then.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to read in a text file that has a quoted email address like the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"XXXX@gmail.com"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I use the code to send this, it is looking like it is stripping the quotes and causing it to not send the email.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I instead put the following in the text file that gets read in with the email address, it works:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"XXXX@gmail.com" "XXXX@gmail.com"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For some reason, when I have two quoted email address I don't have a problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;</description>
      <pubDate>Thu, 06 Sep 2018 14:48:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/QUOTE/m-p/493042#M129688</guid>
      <dc:creator>pchappus</dc:creator>
      <dc:date>2018-09-06T14:48:37Z</dc:date>
    </item>
    <item>
      <title>Re: %QUOTE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/QUOTE/m-p/493068#M129695</link>
      <description>&lt;P&gt;The issue appears to be maybe in the PROC import. Trying to find out if PROC import strips the quotes from a quoted string.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Paul&lt;/P&gt;</description>
      <pubDate>Thu, 06 Sep 2018 15:23:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/QUOTE/m-p/493068#M129695</guid>
      <dc:creator>pchappus</dc:creator>
      <dc:date>2018-09-06T15:23:41Z</dc:date>
    </item>
    <item>
      <title>Re: %QUOTE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/QUOTE/m-p/493085#M129698</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/212034"&gt;@pchappus&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;The issue appears to be maybe in the PROC import. Trying to find out if PROC import strips the quotes from a quoted string.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Paul&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Are you reading from a CSV file (delimited text file)?&amp;nbsp; In a CSV file quotes around values are considered optional and are removed.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That is how you can have values in your file that contain the comma (or whatever delimiter you are using) and still be able to parse the lines. If your values contain actual quotes then the value should be quoted and any embedded quotes (of the same type as the values is enclosed in) need to doubled up.&amp;nbsp; For SAS you can use either single or double quote characters on the outside.&lt;/P&gt;
&lt;P&gt;So for example a record that had NAME='Smith, Fred' and email='fred.smith@company.org' and nickname='"Rock"' would be written to a CSV file like this:&lt;/P&gt;
&lt;PRE&gt;Name,Email,Nickname
"Smith, Fred",fred.smith@company.org,"""Rock"""&lt;/PRE&gt;
&lt;P&gt;If you do have a CSV file and you want to preserve the quotes around a particular columns values you can use the ~ modifier on the INPUT statement.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;data test ;
 length name email nickname $50 ;
 infile cards dsd truncover firstobs=2;
 input name email nickname ~;
cards;
Name,Email,Nickname
"Smith, Fred",fred.smith@company.org,"Rock"
;;;;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;PRE&gt;Obs       name                email             nickname

 1     Smith, Fred    fred.smith@company.org     "Rock"&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Sep 2018 16:02:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/QUOTE/m-p/493085#M129698</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-09-06T16:02:11Z</dc:date>
    </item>
    <item>
      <title>Re: %QUOTE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/QUOTE/m-p/493088#M129699</link>
      <description>&lt;P&gt;Note that to the macro processor quotes are part of the value.&amp;nbsp; To the macro processor everything is just text so there is no need to add quotes around stings to help the parser figure out that the word is not meant as a number or variable name or keyword.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;So if your macro variable contains XXX and you compare it to "XXX" it will not match since one starts with X and the other with a double quote character.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let email = fred.smith@company.org ;
...
%if &amp;amp;email = fred.smith@company.org %then %do;
%put Sending email to Fred ;
...
%end;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Sep 2018 16:07:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/QUOTE/m-p/493088#M129699</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2018-09-06T16:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: %QUOTE</title>
      <link>https://communities.sas.com/t5/SAS-Programming/QUOTE/m-p/493453#M129814</link>
      <description>&lt;P&gt;%QUOTE is obsolete . It can't mask single/double quote , use %bquote() instead.&lt;/P&gt;
&lt;P&gt;For now ,generally consider these three macro mask function&amp;nbsp; %BQUOTE() %NRBQUOTE() %SUPERQ()&lt;/P&gt;</description>
      <pubDate>Fri, 07 Sep 2018 14:38:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/QUOTE/m-p/493453#M129814</guid>
      <dc:creator>Ksharp</dc:creator>
      <dc:date>2018-09-07T14:38:57Z</dc:date>
    </item>
  </channel>
</rss>

