<?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 Error Message: &amp;quot;Unmatched brackets were detected&amp;quot; but Is It Really Macro Variable Resolution Problem in SAS Health and Life Sciences</title>
    <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Error-Message-quot-Unmatched-brackets-were-detected-quot-but-Is/m-p/245459#M2429</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I have a macro which is compiled prior to running my program in SDD.&amp;nbsp; This is the macro:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt; mr_sql_pct(numerator=, denominator=, newvar=, label=, decimal=&lt;STRONG&gt;1&lt;/STRONG&gt;);&lt;/P&gt;
&lt;P&gt;catt(put((sum(&amp;amp;numerator)/&amp;amp;denominator)*&lt;STRONG&gt;100&lt;/STRONG&gt;, &lt;STRONG&gt;5.&lt;/STRONG&gt;&amp;amp;decimal)) as &amp;amp;newvar label="&amp;amp;label",&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt; mr_sql_pct;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I have code that is similar to the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sql&lt;/STRONG&gt; noprint;&lt;/P&gt;
&lt;P&gt;select count(distinct name) into :treated&lt;/P&gt;
&lt;P&gt;from sashelp.class;&lt;/P&gt;
&lt;P&gt;create table stats as&lt;/P&gt;
&lt;P&gt;select&lt;/P&gt;
&lt;P&gt;%&lt;STRONG&gt;&lt;EM&gt;mr_sql_pct&lt;/EM&gt;&lt;/STRONG&gt;(numerator=not missing(sex), denominator=%eval(&amp;amp;treated), newvar=pct, label=%)&lt;/P&gt;
&lt;P&gt;sex label='Gender'&lt;/P&gt;
&lt;P&gt;from sashelp.class&lt;/P&gt;
&lt;P&gt;group by sex;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;This code runs correctly in PC SAS, but in SDD if I even try to hit 'save' I get a message "Unmatched brackets were detected in the following statement(s)" and then it highlights everything from "create" to the semicolon.&amp;nbsp; The program runs with errors, but I can't see where the unmatched brackets could possibly be.&amp;nbsp; I have other programs that run similar macros in SDD, and only the programs that use a macro variable reference in the call to a macro are the ones that are giving these errors.&amp;nbsp; So is the real problem the fact that I can't use this macro variable reference in the macro call?&amp;nbsp; Is there a way to fix this without significant re-coding?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Thanks in advance for your help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Cheers,&lt;/P&gt;
&lt;P&gt;Mary R.&lt;/P&gt;</description>
    <pubDate>Fri, 22 Jan 2016 15:24:14 GMT</pubDate>
    <dc:creator>MaryR</dc:creator>
    <dc:date>2016-01-22T15:24:14Z</dc:date>
    <item>
      <title>Error Message: "Unmatched brackets were detected" but Is It Really Macro Variable Resolution Problem</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Error-Message-quot-Unmatched-brackets-were-detected-quot-but-Is/m-p/245459#M2429</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I have a macro which is compiled prior to running my program in SDD.&amp;nbsp; This is the macro:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt; mr_sql_pct(numerator=, denominator=, newvar=, label=, decimal=&lt;STRONG&gt;1&lt;/STRONG&gt;);&lt;/P&gt;
&lt;P&gt;catt(put((sum(&amp;amp;numerator)/&amp;amp;denominator)*&lt;STRONG&gt;100&lt;/STRONG&gt;, &lt;STRONG&gt;5.&lt;/STRONG&gt;&amp;amp;decimal)) as &amp;amp;newvar label="&amp;amp;label",&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;%mend&lt;/STRONG&gt; mr_sql_pct;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I have code that is similar to the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;proc&lt;/STRONG&gt; &lt;STRONG&gt;sql&lt;/STRONG&gt; noprint;&lt;/P&gt;
&lt;P&gt;select count(distinct name) into :treated&lt;/P&gt;
&lt;P&gt;from sashelp.class;&lt;/P&gt;
&lt;P&gt;create table stats as&lt;/P&gt;
&lt;P&gt;select&lt;/P&gt;
&lt;P&gt;%&lt;STRONG&gt;&lt;EM&gt;mr_sql_pct&lt;/EM&gt;&lt;/STRONG&gt;(numerator=not missing(sex), denominator=%eval(&amp;amp;treated), newvar=pct, label=%)&lt;/P&gt;
&lt;P&gt;sex label='Gender'&lt;/P&gt;
&lt;P&gt;from sashelp.class&lt;/P&gt;
&lt;P&gt;group by sex;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;quit&lt;/STRONG&gt;;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;This code runs correctly in PC SAS, but in SDD if I even try to hit 'save' I get a message "Unmatched brackets were detected in the following statement(s)" and then it highlights everything from "create" to the semicolon.&amp;nbsp; The program runs with errors, but I can't see where the unmatched brackets could possibly be.&amp;nbsp; I have other programs that run similar macros in SDD, and only the programs that use a macro variable reference in the call to a macro are the ones that are giving these errors.&amp;nbsp; So is the real problem the fact that I can't use this macro variable reference in the macro call?&amp;nbsp; Is there a way to fix this without significant re-coding?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Thanks in advance for your help!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;Cheers,&lt;/P&gt;
&lt;P&gt;Mary R.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2016 15:24:14 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Error-Message-quot-Unmatched-brackets-were-detected-quot-but-Is/m-p/245459#M2429</guid>
      <dc:creator>MaryR</dc:creator>
      <dc:date>2016-01-22T15:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: Error Message: "Unmatched brackets were detected" but Is It Really Macro Variable Reso</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Error-Message-quot-Unmatched-brackets-were-detected-quot-but-Is/m-p/245480#M2430</link>
      <description>&lt;P&gt;We have figured out the issue with this and I wanted to post it here too:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The problem is with the '%)' in the macro call.&amp;nbsp; It seems that the '%' is masking the ')' in SDD, and that is causing the 'unmatched brackets' message.&amp;nbsp; The solution is to simply put a space between the '%' and the ')'.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks to all those who took a look a this question.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Cheers,&lt;/P&gt;
&lt;P&gt;Mary R.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2016 16:25:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Error-Message-quot-Unmatched-brackets-were-detected-quot-but-Is/m-p/245480#M2430</guid>
      <dc:creator>MaryR</dc:creator>
      <dc:date>2016-01-22T16:25:39Z</dc:date>
    </item>
    <item>
      <title>Re: Error Message: "Unmatched brackets were detected" but Is It Really Macro Variable Reso</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Error-Message-quot-Unmatched-brackets-were-detected-quot-but-Is/m-p/245484#M2431</link>
      <description>&lt;P&gt;Glad you found it&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/40871"&gt;@MaryR﻿&lt;/a&gt;! &amp;nbsp;I was about to ping&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4838"&gt;@Lex_SAS﻿&lt;/a&gt;&amp;nbsp;and colleagues to make sure they saw the query.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2016 16:30:48 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Error-Message-quot-Unmatched-brackets-were-detected-quot-but-Is/m-p/245484#M2431</guid>
      <dc:creator>ChrisHemedinger</dc:creator>
      <dc:date>2016-01-22T16:30:48Z</dc:date>
    </item>
    <item>
      <title>Re: Error Message: "Unmatched brackets were detected" but Is It Really Macro Variable Reso</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Error-Message-quot-Unmatched-brackets-were-detected-quot-but-Is/m-p/245488#M2432</link>
      <description>&lt;P&gt;It is interesting that PC SAS did not have an issue with this .... Maybe a different SAS version compared to the one on SDD?&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2016 16:37:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Error-Message-quot-Unmatched-brackets-were-detected-quot-but-Is/m-p/245488#M2432</guid>
      <dc:creator>Lex_SAS</dc:creator>
      <dc:date>2016-01-22T16:37:01Z</dc:date>
    </item>
    <item>
      <title>Re: Error Message: "Unmatched brackets were detected" but Is It Really Macro Variable Reso</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Error-Message-quot-Unmatched-brackets-were-detected-quot-but-Is/m-p/245508#M2433</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/4838"&gt;@Lex_SAS﻿&lt;/a&gt;&amp;nbsp;why would PC SAS have a problem with it?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It looks like valid code to me.&amp;nbsp; The % alone should not be enough to mask the ), since it's not wrapped in %str().&amp;nbsp; At least, this simple example works fine:&lt;/P&gt;
&lt;PRE&gt;1    %macro test(text=);
2    %put &amp;gt;&amp;gt;&amp;amp;text&amp;lt;&amp;lt;;
3    %mend test;
4    %test(text=some%)
&amp;gt;&amp;gt;some%&amp;lt;&amp;lt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/40871"&gt;@MaryR﻿&lt;/a&gt;'s code also runs fine for me in PC SAS (9.3).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't know anything about SDD.&amp;nbsp; But if the error message pops up when she hits "SAVE", wouldn't that suggest it's some SDD code parser/syntax highlighter that is having the problem, not actually SAS tokenizer?&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2016 17:37:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Error-Message-quot-Unmatched-brackets-were-detected-quot-but-Is/m-p/245508#M2433</guid>
      <dc:creator>Quentin</dc:creator>
      <dc:date>2016-01-22T17:37:41Z</dc:date>
    </item>
    <item>
      <title>Re: Error Message: "Unmatched brackets were detected" but Is It Really Macro Variable Reso</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Error-Message-quot-Unmatched-brackets-were-detected-quot-but-Is/m-p/245521#M2434</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/19879"&gt;@Quentin﻿&lt;/a&gt; Obviously PC SAS did not have an issue with it, but SDD did. I'll pass it onto Tech Support, since I'm no SDD expert either.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jan 2016 19:10:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Error-Message-quot-Unmatched-brackets-were-detected-quot-but-Is/m-p/245521#M2434</guid>
      <dc:creator>Lex_SAS</dc:creator>
      <dc:date>2016-01-22T19:10:00Z</dc:date>
    </item>
    <item>
      <title>Re: Error Message: "Unmatched brackets were detected" but Is It Really Macro Variable Reso</title>
      <link>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Error-Message-quot-Unmatched-brackets-were-detected-quot-but-Is/m-p/253607#M2435</link>
      <description>&lt;P&gt;Thanks so much for your help!&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2016 21:32:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Health-and-Life-Sciences/Error-Message-quot-Unmatched-brackets-were-detected-quot-but-Is/m-p/253607#M2435</guid>
      <dc:creator>MaryR</dc:creator>
      <dc:date>2016-03-01T21:32:20Z</dc:date>
    </item>
  </channel>
</rss>

