<?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 How to pass macro parameters that contains commas, quotes...etc in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-pass-macro-parameters-that-contains-commas-quotes-etc/m-p/23316#M3851</link>
    <description>Hi all,&lt;BR /&gt;
&lt;BR /&gt;
I'm hoping that you can help me to try and get this right.&lt;BR /&gt;
&lt;BR /&gt;
I am trying to pass a piece of text into a macro as a macro parameter, but I keep getting &lt;BR /&gt;
&lt;BR /&gt;
ERROR: Literal contains unmatched quote.&lt;BR /&gt;
ERROR: The macro SQL_INSERT will stop executing.&lt;BR /&gt;
&lt;BR /&gt;
The call macro call is :&lt;BR /&gt;
&lt;BR /&gt;
%sql_insert(proj_name=&amp;amp;mvar_projectname,&lt;BR /&gt;
		idd=&amp;amp;mvar_id,&lt;BR /&gt;
		dt=&amp;amp;mvar_changed,&lt;BR /&gt;
	        rq="&amp;amp;mvar_requirements",&lt;BR /&gt;
		category=&amp;amp;mvar_applicationcategory_k);&lt;BR /&gt;
&lt;BR /&gt;
The macro variable is a variable length text paragraph that may contain commas, single/ double quotes, &amp;amp; symbols and unmatched quotes and parenthesis.&lt;BR /&gt;
&lt;BR /&gt;
So, I have tried numerous quoting methods to no avail, like enclosing &amp;amp;mvar_requirements in %str()...etc. Is there a method to cover all symbols?&lt;BR /&gt;
&lt;BR /&gt;
Hope someone can help.&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance.</description>
    <pubDate>Fri, 24 Apr 2009 15:15:00 GMT</pubDate>
    <dc:creator>deleted_user</dc:creator>
    <dc:date>2009-04-24T15:15:00Z</dc:date>
    <item>
      <title>How to pass macro parameters that contains commas, quotes...etc</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-pass-macro-parameters-that-contains-commas-quotes-etc/m-p/23316#M3851</link>
      <description>Hi all,&lt;BR /&gt;
&lt;BR /&gt;
I'm hoping that you can help me to try and get this right.&lt;BR /&gt;
&lt;BR /&gt;
I am trying to pass a piece of text into a macro as a macro parameter, but I keep getting &lt;BR /&gt;
&lt;BR /&gt;
ERROR: Literal contains unmatched quote.&lt;BR /&gt;
ERROR: The macro SQL_INSERT will stop executing.&lt;BR /&gt;
&lt;BR /&gt;
The call macro call is :&lt;BR /&gt;
&lt;BR /&gt;
%sql_insert(proj_name=&amp;amp;mvar_projectname,&lt;BR /&gt;
		idd=&amp;amp;mvar_id,&lt;BR /&gt;
		dt=&amp;amp;mvar_changed,&lt;BR /&gt;
	        rq="&amp;amp;mvar_requirements",&lt;BR /&gt;
		category=&amp;amp;mvar_applicationcategory_k);&lt;BR /&gt;
&lt;BR /&gt;
The macro variable is a variable length text paragraph that may contain commas, single/ double quotes, &amp;amp; symbols and unmatched quotes and parenthesis.&lt;BR /&gt;
&lt;BR /&gt;
So, I have tried numerous quoting methods to no avail, like enclosing &amp;amp;mvar_requirements in %str()...etc. Is there a method to cover all symbols?&lt;BR /&gt;
&lt;BR /&gt;
Hope someone can help.&lt;BR /&gt;
&lt;BR /&gt;
Thanks in advance.</description>
      <pubDate>Fri, 24 Apr 2009 15:15:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-pass-macro-parameters-that-contains-commas-quotes-etc/m-p/23316#M3851</guid>
      <dc:creator>deleted_user</dc:creator>
      <dc:date>2009-04-24T15:15:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass macro parameters that contains commas, quotes...etc</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-pass-macro-parameters-that-contains-commas-quotes-etc/m-p/23317#M3852</link>
      <description>Hi.&lt;BR /&gt;
&lt;BR /&gt;
Well, that depends on what your trying to quote.&lt;BR /&gt;
&lt;BR /&gt;
see: &lt;A href="http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a001072333.htm" target="_blank"&gt;http://support.sas.com/documentation/cdl/en/mcrolref/61885/HTML/default/a001072333.htm&lt;/A&gt;&lt;BR /&gt;
&lt;BR /&gt;
for macro quotting functions.&lt;BR /&gt;
&lt;BR /&gt;
Greetings from Portugal.&lt;BR /&gt;
&lt;BR /&gt;
Daniel Santos at &lt;A href="http://www.cgd.pt" target="_blank"&gt;www.cgd.pt&lt;/A&gt;</description>
      <pubDate>Fri, 24 Apr 2009 15:48:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-pass-macro-parameters-that-contains-commas-quotes-etc/m-p/23317#M3852</guid>
      <dc:creator>DanielSantos</dc:creator>
      <dc:date>2009-04-24T15:48:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass macro parameters that contains commas, quotes...etc</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-pass-macro-parameters-that-contains-commas-quotes-etc/m-p/23318#M3853</link>
      <description>Try using %SUPERQ around the macro variable that is causing the problem, for example:&lt;BR /&gt;
&lt;BR /&gt;
%sql_insert(proj_name=%superq(mvar_projectname),&lt;BR /&gt;
&lt;BR /&gt;
It catches everything.  Notice there is no &amp;amp; in front of the macro variable when using %SUPERQ.</description>
      <pubDate>Wed, 29 Apr 2009 17:36:08 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-pass-macro-parameters-that-contains-commas-quotes-etc/m-p/23318#M3853</guid>
      <dc:creator>Russ_SAS</dc:creator>
      <dc:date>2009-04-29T17:36:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to pass macro parameters that contains commas, quotes...etc</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-pass-macro-parameters-that-contains-commas-quotes-etc/m-p/574989#M162538</link>
      <description>&lt;P&gt;Depending on what characters you want to pass as a macro parameter value, you might need to use different SAS macro functions that provide "character masking". These macro functions are collectively called macro quoting functions. There are 7 of them, each has its own set of characters they mask, and the sets of those characters overlap between them. They also differ by their timing: A) macro compilation; or B) macro execution. You use macro compilation functions to mask characters in a string constants not containing &amp;amp; % or mnemonics (GT EQ OR AND etc). And you use macro execution functions otherwise.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here are the 7 macro quoting functions:&lt;/P&gt;
&lt;P&gt;A) Work at macro compilation&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=n09tblrxldh8k0n1kt6dkj3xlxug.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" rel="noopener noreferrer"&gt;%STR() and %NRSTR()&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;B) Work at macro execution&lt;/P&gt;
&lt;P&gt;&lt;A href="https://go.documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=p1780jrqrtwtw7n16x83peo2zpxr.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" rel="noopener noreferrer"&gt;%QUOTE() and %NRQUOTE()&lt;/A&gt;, &lt;A href="https://go.documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=p06cx7fegzmzpen1m9991yljxiav.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" rel="noopener noreferrer"&gt;%BQUOTE() and %NRBQUOTE()&lt;/A&gt;, and &lt;A href="https://go.documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=p1780jrqrtwtw7n16x83peo2zpxr.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" rel="noopener noreferrer"&gt;%SUPERQ()&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I use "pass them inside the box" analogy to explain how they work in my recent blog post &lt;A title="Masking commas when passing comma-separated values into SAS macro functions or SAS macros" href="https://blogs.sas.com/content/sgf/2019/07/17/passing-comma-delimited-values-into-sas-macros-and-macro-functions/" target="_self"&gt;Passing comma-delimited values into SAS macros and macro functions.&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jul 2019 15:42:40 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-pass-macro-parameters-that-contains-commas-quotes-etc/m-p/574989#M162538</guid>
      <dc:creator>LeonidBatkhan</dc:creator>
      <dc:date>2019-07-19T15:42:40Z</dc:date>
    </item>
  </channel>
</rss>

