<?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: macro quote question in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro-quote-question/m-p/14386#M1826</link>
    <description>Either one below works as well.&lt;BR /&gt;&lt;BR /&gt;
&lt;BR /&gt;&lt;BR /&gt;
&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#000000;font-family:Courier New;font-size:10pt;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;store&amp;nbsp;like&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#800080;font-family:Courier New;font-size:10pt;"&gt;'%MACY''S%'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;
&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;
&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;where&amp;nbsp;index(store,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#800080;font-family:Courier New;font-size:10pt;"&gt;"MACY'S"&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;)&lt;/SPAN&gt;</description>
    <pubDate>Wed, 15 Jun 2011 20:39:50 GMT</pubDate>
    <dc:creator>chang_y_chung_hotmail_com</dc:creator>
    <dc:date>2011-06-15T20:39:50Z</dc:date>
    <item>
      <title>macro quote question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-quote-question/m-p/14383#M1823</link>
      <description>SAS is not able to process the following macro code. Please help!&lt;BR /&gt;
&lt;BR /&gt;
%let a=%str(store_name like "%MACY'S%" );&lt;BR /&gt;
&lt;BR /&gt;
%put &amp;amp;a.;</description>
      <pubDate>Wed, 15 Jun 2011 18:55:32 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-quote-question/m-p/14383#M1823</guid>
      <dc:creator>MarcTC</dc:creator>
      <dc:date>2011-06-15T18:55:32Z</dc:date>
    </item>
    <item>
      <title>Re: macro quote question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-quote-question/m-p/14384#M1824</link>
      <description>This works I think.  It can probably be simplified.&lt;BR /&gt;
&lt;BR /&gt;
[pre]&lt;BR /&gt;
%let a=%nrstr(store_name like "%%MACY%'S%%" );&lt;BR /&gt;
%put &amp;amp;a.; &lt;BR /&gt;
&lt;BR /&gt;
data test;&lt;BR /&gt;
   input store_name $10.;&lt;BR /&gt;
   cards;&lt;BR /&gt;
MACY'S&lt;BR /&gt;
DILLARD'S&lt;BR /&gt;
;;;;&lt;BR /&gt;
   run;&lt;BR /&gt;
&lt;BR /&gt;
proc sql;&lt;BR /&gt;
   select * from test where &amp;amp;a;&lt;BR /&gt;
   quit;&lt;BR /&gt;
   run;&lt;BR /&gt;
[/pre]</description>
      <pubDate>Wed, 15 Jun 2011 19:23:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-quote-question/m-p/14384#M1824</guid>
      <dc:creator>data_null__</dc:creator>
      <dc:date>2011-06-15T19:23:53Z</dc:date>
    </item>
    <item>
      <title>Re: macro quote question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-quote-question/m-p/14385#M1825</link>
      <description>thanks _null_!&lt;BR /&gt;
&lt;BR /&gt;
Your suggestion works.&lt;BR /&gt;
&lt;BR /&gt;
Do you know how to correct the unbalanced quote problem created by my original macro code? My SAS completely stopped even though I applied the following code:&lt;BR /&gt;
&lt;BR /&gt;
 *';*";*%; &lt;BR /&gt;
run;</description>
      <pubDate>Wed, 15 Jun 2011 19:55:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-quote-question/m-p/14385#M1825</guid>
      <dc:creator>MarcTC</dc:creator>
      <dc:date>2011-06-15T19:55:59Z</dc:date>
    </item>
    <item>
      <title>Re: macro quote question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-quote-question/m-p/14386#M1826</link>
      <description>Either one below works as well.&lt;BR /&gt;&lt;BR /&gt;
&lt;BR /&gt;&lt;BR /&gt;
&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#000000;font-family:Courier New;font-size:10pt;"&gt;where&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;store&amp;nbsp;like&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#800080;font-family:Courier New;font-size:10pt;"&gt;'%MACY''S%'&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;
&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;
&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;where&amp;nbsp;index(store,&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN style="color:#800080;font-family:Courier New;font-size:10pt;"&gt;"MACY'S"&lt;/SPAN&gt;&lt;SPAN style="font-family:Courier New;font-size:10pt;"&gt;)&lt;/SPAN&gt;</description>
      <pubDate>Wed, 15 Jun 2011 20:39:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-quote-question/m-p/14386#M1826</guid>
      <dc:creator>chang_y_chung_hotmail_com</dc:creator>
      <dc:date>2011-06-15T20:39:50Z</dc:date>
    </item>
    <item>
      <title>Re: macro quote question</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-quote-question/m-p/14387#M1827</link>
      <description>To correct the code:&lt;BR /&gt;
&lt;BR /&gt;
1.  Use %NRSTR instead of %STR to mask the actual % characters in your text.  %STR does not mask % or &amp;amp; characters.&lt;BR /&gt;
&lt;BR /&gt;
2.  Use an extra % (as an escape character) before literal % characters and also before an unbalanced quote:&lt;BR /&gt;
&lt;BR /&gt;
%let a=%nrstr(store_name like "%%MACY%'S%%" ); &lt;BR /&gt;
&lt;BR /&gt;
Finally, after submitting bad code (especially unbalanced quotes), an interactive SAS system may become unresponsive.  To purge the system and restore functionality, first try submitting this code repeatedly:&lt;BR /&gt;
*';*";*);%mend; run cancel; &lt;BR /&gt;
&lt;BR /&gt;
You should eventually see this error message in the SAS log:&lt;BR /&gt;
ERROR: No matching %MACRO statement for this %MEND statement.&lt;BR /&gt;
&lt;BR /&gt;
This is the expected response to the %MEND statement in the above text string, and indicates that SAS has resumed normal operation.  If this doesn't work, you'll probably need to restart SAS.</description>
      <pubDate>Thu, 16 Jun 2011 00:45:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-quote-question/m-p/14387#M1827</guid>
      <dc:creator>SASJedi</dc:creator>
      <dc:date>2011-06-16T00:45:30Z</dc:date>
    </item>
  </channel>
</rss>

