<?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 variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/macro-variable/m-p/79119#M17091</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp; If the macro variable value being passed as a parameter, does NOT contain any macro triggers (% or &amp;amp;), then perhaps %STR would work. If the macro variable DOES contain macro triggers, then %NRSTR would be the place to start. However, there might be compile time vs execution time issues, as well, which is why I posted the links to the doc that talk about when to use which macro quoting functions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Also, it is never a good idea to use quotes in a macro variable value because, as seen with the error message in the TITLE statement, the quotes that surround the macro variable will terminate the quotes that start the TITLE statement and cause the rest of the title text to be placed in open code and generate the "ambiguous" title warning.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; So, for this TITLE statement (TITLE statement quotes are in &lt;SPAN style="color: #ff0000;"&gt;RED&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;title &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/SPAN&gt; #3A&amp;amp;slideNo.#&amp;amp;levelName - &amp;amp;&amp;amp;orgnm. &lt;STRONG style="color: #ff0000;"&gt;"&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp; When resolution happens, the SYMBOLGEN clearly shows that quotes are part of the macro variable value being passed (and the quotes would be unnecessary if the correct macro quoting function was used) -- quotes added to macro variable value are shown in &lt;STRONG style="color: #0000ff;"&gt;BLUE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SYMBOLGEN:&amp;nbsp; Macro variable ORGNM resolves to&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/SPAN&gt;Cu Australia, New Zealand &amp;amp; Fiji &lt;STRONG style="color: #0000ff;"&gt;"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;NOTE: Line generated by the macro variable "ORGNM".&lt;/P&gt;&lt;P&gt;2039&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt; "&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;#3A001#VDP Radio Units -&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt; "&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;Cu Australia, New Zealand &amp;amp; Fiji&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ____________________________&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 49&lt;/P&gt;&lt;P&gt;2039&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; !&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt; "&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;WARNING: The TITLE statement is ambiguous due to invalid options or unquoted text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, the first BLUE quote terminate the first RED quote in the resolved title statement, leaving the Cu Australia, New Zealand &amp;amp; Fiji text hanging out as unquoted text. If the correct macro quoting function was used, no error would be generated.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 Nov 2012 22:48:30 GMT</pubDate>
    <dc:creator>Cynthia_sas</dc:creator>
    <dc:date>2012-11-23T22:48:30Z</dc:date>
    <item>
      <title>macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable/m-p/79113#M17085</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Macro variable contains a character &amp;amp;. It looks like Cu Australia, New Zealand &amp;amp; Fiji.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Var1 = Cu Australia, New Zealand &amp;amp; Fiji&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am passing this variable&lt;/P&gt;&lt;P&gt;%macro test(name1='&amp;amp;Var1')&lt;/P&gt;&lt;P&gt;I am getting results as 'Cu Australia, New Zealand &amp;amp; Fiji', but i dont want to see the single quotes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; without&amp;nbsp; quote i am getting error as ERROR: All positional parameters must precede keyword parameters.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Nov 2012 17:19:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable/m-p/79113#M17085</guid>
      <dc:creator>sunilreddy</dc:creator>
      <dc:date>2012-11-23T17:19:09Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable/m-p/79114#M17086</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It won't resolve unless you use double rather than single quotes.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Nov 2012 17:24:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable/m-p/79114#M17086</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-11-23T17:24:01Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable/m-p/79115#M17087</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;%mrp_sdc(orgid=&amp;amp;&amp;amp;CUID&amp;amp;x, orgnm="&amp;amp;&amp;amp;CUNM&amp;amp;x");&lt;/P&gt;&lt;P&gt;I've used double quotes while passing macro variable&amp;nbsp; as above, but i am getting below error in macro function&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;title " #3A&amp;amp;slideNo.#&amp;amp;levelName - &amp;amp;&amp;amp;orgnm. ";&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SYMBOLGEN:&amp;nbsp; Macro variable ORGNM resolves to "Cu Australia, New Zealand &amp;amp; Fiji&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "&lt;/P&gt;&lt;P&gt;NOTE: Line generated by the macro variable "ORGNM".&lt;/P&gt;&lt;P&gt;2039&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; " #3A001#VDP Radio Units - "Cu Australia, New Zealand &amp;amp; Fiji&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ____________________________&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 49&lt;/P&gt;&lt;P&gt;2039&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; !&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; "&lt;/P&gt;&lt;P&gt;WARNING: The TITLE statement is ambiguous due to invalid options or unquoted text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Nov 2012 19:55:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable/m-p/79115#M17087</guid>
      <dc:creator>sunilreddy</dc:creator>
      <dc:date>2012-11-23T19:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable/m-p/79116#M17088</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It will be easier to look at if you post your full code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Nov 2012 20:20:29 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable/m-p/79116#M17088</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2012-11-23T20:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable/m-p/79117#M17089</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi:&lt;/P&gt;&lt;P&gt;&amp;nbsp; I agree with Art. Seeing snippets of code doesn't help here. But meanwhile, here are some references that may help you understand why the , and &amp;amp; are causing issues.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/resources/papers/proceedings10/029-2010.pdf"&gt;http://support.sas.com/resources/papers/proceedings10/029-2010.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/62978/HTML/default/viewer.htm#n1oerrlvth1qy5n1bgeje94oloud.htm"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/62978/HTML/default/viewer.htm#n1oerrlvth1qy5n1bgeje94oloud.htm&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/62978/HTML/default/viewer.htm#p0pwrvnlcooi3tn0z3g1755ebcng.htm#n0kn3pg0zmvku6n1f3zr3m8l7tp7"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/62978/HTML/default/viewer.htm#p0pwrvnlcooi3tn0z3g1755ebcng.htm#n0kn3pg0zmvku6n1f3zr3m8l7tp7&lt;/A&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Nov 2012 20:43:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable/m-p/79117#M17089</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2012-11-23T20:43:44Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable/m-p/79118#M17090</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;How about try : %macro test(name1=%str(&amp;amp;Var1))&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'Helvetica Neue', Helvetica, Arial, 'Lucida Grande', sans-serif; background-color: #ffffff;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Nov 2012 20:51:26 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable/m-p/79118#M17090</guid>
      <dc:creator>Tanya</dc:creator>
      <dc:date>2012-11-23T20:51:26Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable/m-p/79119#M17091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp; If the macro variable value being passed as a parameter, does NOT contain any macro triggers (% or &amp;amp;), then perhaps %STR would work. If the macro variable DOES contain macro triggers, then %NRSTR would be the place to start. However, there might be compile time vs execution time issues, as well, which is why I posted the links to the doc that talk about when to use which macro quoting functions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Also, it is never a good idea to use quotes in a macro variable value because, as seen with the error message in the TITLE statement, the quotes that surround the macro variable will terminate the quotes that start the TITLE statement and cause the rest of the title text to be placed in open code and generate the "ambiguous" title warning.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; So, for this TITLE statement (TITLE statement quotes are in &lt;SPAN style="color: #ff0000;"&gt;RED&lt;/SPAN&gt;)&lt;/P&gt;&lt;P&gt;title &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/SPAN&gt; #3A&amp;amp;slideNo.#&amp;amp;levelName - &amp;amp;&amp;amp;orgnm. &lt;STRONG style="color: #ff0000;"&gt;"&lt;/STRONG&gt;;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp; When resolution happens, the SYMBOLGEN clearly shows that quotes are part of the macro variable value being passed (and the quotes would be unnecessary if the correct macro quoting function was used) -- quotes added to macro variable value are shown in &lt;STRONG style="color: #0000ff;"&gt;BLUE&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SYMBOLGEN:&amp;nbsp; Macro variable ORGNM resolves to&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;&lt;/SPAN&gt;Cu Australia, New Zealand &amp;amp; Fiji &lt;STRONG style="color: #0000ff;"&gt;"&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;NOTE: Line generated by the macro variable "ORGNM".&lt;/P&gt;&lt;P&gt;2039&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #ff0000;"&gt;&lt;STRONG&gt; "&lt;/STRONG&gt;&lt;/SPAN&gt; &lt;SPAN style="color: #ff0000;"&gt;#3A001#VDP Radio Units -&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt; "&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;SPAN style="color: #0000ff;"&gt;Cu Australia, New Zealand &amp;amp; Fiji&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ____________________________&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 49&lt;/P&gt;&lt;P&gt;2039&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; !&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt; "&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;WARNING: The TITLE statement is ambiguous due to invalid options or unquoted text.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, the first BLUE quote terminate the first RED quote in the resolved title statement, leaving the Cu Australia, New Zealand &amp;amp; Fiji text hanging out as unquoted text. If the correct macro quoting function was used, no error would be generated.&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Nov 2012 22:48:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable/m-p/79119#M17091</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2012-11-23T22:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable/m-p/79120#M17092</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to do something to the value of a macro parameter to protect commas, ampersands or other special macro characters.&lt;/P&gt;&lt;P&gt;You could add code where the macro variable is referenced inside the macro to remove the quotes.&amp;nbsp; For example you might try using the DEQUOTE() function. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%macro test(var1);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&amp;nbsp; %put Dequoted value= %qsysfunc(dequote(&amp;amp;var1));&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%mend test;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%test(var1='High &amp;amp; Low');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Dequoted value= High &amp;amp; Low&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%test(var1=Normal);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Dequoted value= Normal&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%let X=High;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%test(var1='&amp;amp;x');&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Dequoted value= &amp;amp;x&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;%test(var1="&amp;amp;x");&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;Dequoted value= High&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="font-family: 'courier new', courier;"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Nov 2012 22:56:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable/m-p/79120#M17092</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2012-11-23T22:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable/m-p/79121#M17093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Another approach to try is to wrap the title in single quotes, but mask them during macro resolution&lt;/P&gt;&lt;P&gt;See if this works&lt;/P&gt;&lt;P&gt;title %unquote(%str(%') #3A&amp;amp;slideNo.#&amp;amp;levelName - &amp;amp;&amp;amp;orgnm. %str(%')) ;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Pace Cynthia there is at least one situation where you want quotes in a macro variable:&amp;nbsp; where item IN (&amp;amp;list) &lt;/P&gt;&lt;P&gt;with &amp;amp;list being a set of string variables&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Richard in Oz&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Nov 2012 23:09:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable/m-p/79121#M17093</guid>
      <dc:creator>RichardinOz</dc:creator>
      <dc:date>2012-11-23T23:09:12Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable/m-p/79122#M17094</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Richard:&lt;/P&gt;&lt;P&gt;&amp;nbsp; Yes, you're right! So I'll amend my earlier declaration -- you &lt;SPAN style="text-decoration: underline;"&gt;&lt;STRONG&gt;almost&lt;/STRONG&gt;&lt;/SPAN&gt; never need to "pre-quote" macro variables unless you're using strings in IN lists or another type quoting situation required by the syntax.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; But, a pre-quoted IN list could also cause issues in a TITLE statement, too -- if you pre-quoted with double quotes. Once you understand what's happening and how to deal with it, it is something you CAN deal with...by using single quotes for the IN list and then using double quotes for the TITLE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%let inlist = %str('Alfred', 'Barbara', 'James');&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;proc print data=sashelp.class;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; where name in (&amp;amp;inlist);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; title "Want Students: &amp;amp;inlist";&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;title;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I didn't see the need for unquote or dequote at this point, given what we've been told about the problem. So, I tested something like this...going with the simplest quoting function first.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%macro putit(myvar=);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%put myvar= &amp;amp;myvar;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;proc print data=sashelp.class(obs=2);&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; title "&amp;amp;myvar";&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;run;&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;title;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%mend putit;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;options mprint symbolgen;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods html file='c:\temp\usemacro.html';&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%putit(myvar=%nrstr(1- Fred, Ethel, Lucy &amp;amp; Ricky))&lt;/STRONG&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%putit(myvar=%nrstr(2-Cu Australia, New Zealand &amp;amp; Fiji))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;%putit(myvar=%nrstr(3- Kermit &amp;amp; Elmo Get 50% Each))&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;&amp;nbsp; &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG style="font-family: courier new,courier;"&gt;ods html close;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;cynthia&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 24 Nov 2012 03:06:37 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable/m-p/79122#M17094</guid>
      <dc:creator>Cynthia_sas</dc:creator>
      <dc:date>2012-11-24T03:06:37Z</dc:date>
    </item>
    <item>
      <title>Re: macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/macro-variable/m-p/79123#M17095</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;If you don't want single quotes, leave them out.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you have seen, the comma causes a problem because it marks the end of a macro parameter's value.&amp;nbsp; There are ways around it (some shown above by other posters) possibly this variation as well:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%macro test (name1=%superq(var1));&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is not clear from your post why you would want to set up a default value for &amp;amp;name1.&amp;nbsp; But the syntax would be equally simple if you just used it to call the macro later without using a default value:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;%test (name1=%superq(var1))&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 26 Nov 2012 18:06:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/macro-variable/m-p/79123#M17095</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2012-11-26T18:06:35Z</dc:date>
    </item>
  </channel>
</rss>

