<?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: Issue with macro parameter expression containing . in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-macro-parameter-expression-containing/m-p/75667#M16310</link>
    <description>&amp;gt; %PrintProbleme(&amp;amp;TableContraintes, org, %SUPERQ(org eq&lt;BR /&gt;
&amp;gt; 0 or org eq .), "Rejet1 : org=0", 1);&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; I have trouble withe the parameter : org eq 0 or org&lt;BR /&gt;
&amp;gt; eq .&lt;BR /&gt;
&lt;BR /&gt;
I won't argue about the wisdom of using a macro here, but just point out &lt;BR /&gt;
1 in sql[pre]  org eq 0 or org is null [/pre]may perform better&lt;BR /&gt;
2 in data step[pre]   (if org) [/pre] selects non-missing and non-zero data&lt;BR /&gt;
3 in macro language superq() expects a macro variable (, or macro name) as the parameter, and not plain syntax [pre]   %str( org eq 0 or org = . ) [/pre] might provide adequate protection for that dot. An alternative providing slightly stronger protection than %str() is %quote().&lt;BR /&gt;
Error handling of the failing parameter will (probably) be complicated by the internals of your macro %PrintProbleme.&lt;BR /&gt;
Since this simple use without macro protection of your filter syntax [pre]      %let BC =&lt;BR /&gt;
               org eq 0 or org = . &lt;BR /&gt;
      ;[/pre] works just fine outside a macro... see this log[pre]51         %let BC =&lt;BR /&gt;
52                  org eq 0 or org = .&lt;BR /&gt;
53         ;&lt;BR /&gt;
54   DATA ;&lt;BR /&gt;
55    INPUT ORG REP$ ;&lt;BR /&gt;
56   LIST;CARDS;&lt;BR /&gt;
&lt;BR /&gt;
RULE:      ----+----1----+----2----+----3----+----4----+----5----+----6----&lt;BR /&gt;
57         1 REP1&lt;BR /&gt;
58         2 report2&lt;BR /&gt;
59         . empty&lt;BR /&gt;
60         0 return-code-OK&lt;BR /&gt;
NOTE: The data set WORK.DATA4 has 4 observations and 2 variables.&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.00 seconds&lt;BR /&gt;
      cpu time            0.00 seconds&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
61   ;&lt;BR /&gt;
62   option symbolgen mlogic mprint ;&lt;BR /&gt;
63   data cases;&lt;BR /&gt;
64   set ;&lt;BR /&gt;
SYMBOLGEN:  Macro variable BC resolves to org eq 0 or org = .&lt;BR /&gt;
65    if &amp;amp;bc ;&lt;BR /&gt;
66   run;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: There were 4 observations read from the data set WORK.DATA4.&lt;BR /&gt;
NOTE: The data set WORK.CASES has 2 observations and 2 variables.&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.00 seconds[/pre] &lt;BR /&gt;
I'm assuming the problem you get is caused by the handling of the parameter, rather than that dot in the value of the parameter.&lt;BR /&gt;
 &lt;BR /&gt;
Good Luck&lt;BR /&gt;
PeterC</description>
    <pubDate>Mon, 19 Apr 2010 16:00:56 GMT</pubDate>
    <dc:creator>Peter_C</dc:creator>
    <dc:date>2010-04-19T16:00:56Z</dc:date>
    <item>
      <title>Issue with macro parameter expression containing .</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-macro-parameter-expression-containing/m-p/75666#M16309</link>
      <description>Hello,&lt;BR /&gt;
I would like to make the following macro call :&lt;BR /&gt;
%PrintProbleme(&amp;amp;TableContraintes, org, %SUPERQ(org eq 0 or org eq .), "Rejet1 : org=0", 1);&lt;BR /&gt;
&lt;BR /&gt;
I have trouble withe the parameter : org eq 0 or org eq .&lt;BR /&gt;
&lt;BR /&gt;
I have tried the %Bquote, %Str and %Nrbquote functions too.&lt;BR /&gt;
&lt;BR /&gt;
There is a problem with the point.&lt;BR /&gt;
How could I submit the parameter : org eq 0 or org eq .&lt;BR /&gt;
correctly ?&lt;BR /&gt;
&lt;BR /&gt;
Thank you.&lt;BR /&gt;
&lt;BR /&gt;
Phil</description>
      <pubDate>Mon, 19 Apr 2010 12:29:24 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-macro-parameter-expression-containing/m-p/75666#M16309</guid>
      <dc:creator>phil27</dc:creator>
      <dc:date>2010-04-19T12:29:24Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with macro parameter expression containing .</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-macro-parameter-expression-containing/m-p/75667#M16310</link>
      <description>&amp;gt; %PrintProbleme(&amp;amp;TableContraintes, org, %SUPERQ(org eq&lt;BR /&gt;
&amp;gt; 0 or org eq .), "Rejet1 : org=0", 1);&lt;BR /&gt;
&amp;gt; &lt;BR /&gt;
&amp;gt; I have trouble withe the parameter : org eq 0 or org&lt;BR /&gt;
&amp;gt; eq .&lt;BR /&gt;
&lt;BR /&gt;
I won't argue about the wisdom of using a macro here, but just point out &lt;BR /&gt;
1 in sql[pre]  org eq 0 or org is null [/pre]may perform better&lt;BR /&gt;
2 in data step[pre]   (if org) [/pre] selects non-missing and non-zero data&lt;BR /&gt;
3 in macro language superq() expects a macro variable (, or macro name) as the parameter, and not plain syntax [pre]   %str( org eq 0 or org = . ) [/pre] might provide adequate protection for that dot. An alternative providing slightly stronger protection than %str() is %quote().&lt;BR /&gt;
Error handling of the failing parameter will (probably) be complicated by the internals of your macro %PrintProbleme.&lt;BR /&gt;
Since this simple use without macro protection of your filter syntax [pre]      %let BC =&lt;BR /&gt;
               org eq 0 or org = . &lt;BR /&gt;
      ;[/pre] works just fine outside a macro... see this log[pre]51         %let BC =&lt;BR /&gt;
52                  org eq 0 or org = .&lt;BR /&gt;
53         ;&lt;BR /&gt;
54   DATA ;&lt;BR /&gt;
55    INPUT ORG REP$ ;&lt;BR /&gt;
56   LIST;CARDS;&lt;BR /&gt;
&lt;BR /&gt;
RULE:      ----+----1----+----2----+----3----+----4----+----5----+----6----&lt;BR /&gt;
57         1 REP1&lt;BR /&gt;
58         2 report2&lt;BR /&gt;
59         . empty&lt;BR /&gt;
60         0 return-code-OK&lt;BR /&gt;
NOTE: The data set WORK.DATA4 has 4 observations and 2 variables.&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.00 seconds&lt;BR /&gt;
      cpu time            0.00 seconds&lt;BR /&gt;
&lt;BR /&gt;
&lt;BR /&gt;
61   ;&lt;BR /&gt;
62   option symbolgen mlogic mprint ;&lt;BR /&gt;
63   data cases;&lt;BR /&gt;
64   set ;&lt;BR /&gt;
SYMBOLGEN:  Macro variable BC resolves to org eq 0 or org = .&lt;BR /&gt;
65    if &amp;amp;bc ;&lt;BR /&gt;
66   run;&lt;BR /&gt;
&lt;BR /&gt;
NOTE: There were 4 observations read from the data set WORK.DATA4.&lt;BR /&gt;
NOTE: The data set WORK.CASES has 2 observations and 2 variables.&lt;BR /&gt;
NOTE: DATA statement used (Total process time):&lt;BR /&gt;
      real time           0.00 seconds[/pre] &lt;BR /&gt;
I'm assuming the problem you get is caused by the handling of the parameter, rather than that dot in the value of the parameter.&lt;BR /&gt;
 &lt;BR /&gt;
Good Luck&lt;BR /&gt;
PeterC</description>
      <pubDate>Mon, 19 Apr 2010 16:00:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-macro-parameter-expression-containing/m-p/75667#M16310</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-04-19T16:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with macro parameter expression containing .</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-macro-parameter-expression-containing/m-p/75668#M16311</link>
      <description>Thank you Peter.&lt;BR /&gt;
&lt;BR /&gt;
I have modified the PrintProbleme macro removing the %str calls :&lt;BR /&gt;
&lt;BR /&gt;
%Macro PrintProbleme(MyTableIn, MyVar, MyCondition, MyTitle3, MyAffichePasSiZero) / store;&lt;BR /&gt;
	%LOCAL Nb;&lt;BR /&gt;
	%Let Nb=0;&lt;BR /&gt;
 &lt;BR /&gt;
	/* Calcul nombre d'enregistrements */&lt;BR /&gt;
	Proc Sql noprint; SELECT Count(1) INTO :Nb FROM &amp;amp;MyTableIn WHERE &amp;amp;MyCondition; Quit;&lt;BR /&gt;
 &lt;BR /&gt;
	%IF (%Eval(&amp;amp;Nb)&amp;gt;0) OR (%Eval(&amp;amp;MyAffichePasSiZero) ne 1) %Then %Do;&lt;BR /&gt;
		%Title3Pdf(%STR(&amp;amp;MyTitle3 : &amp;amp;Nb. Enregistrements));&lt;BR /&gt;
 &lt;BR /&gt;
		DATA temp;&lt;BR /&gt;
			SET &amp;amp;MyTableIn;&lt;BR /&gt;
			Obs = _N_;&lt;BR /&gt;
			%LabelsVarsNatives();&lt;BR /&gt;
		Run;&lt;BR /&gt;
 &lt;BR /&gt;
		Proc Print DATA=temp label style(TABLE)={width=1000};&lt;BR /&gt;
			Id Obs / style=[just=center color=black fontsize=8PT];&lt;BR /&gt;
			Var org noagent statut contrat &amp;amp;MyVar / style=[just=center color=black fontsize=8PT];&lt;BR /&gt;
			/* ajouter style(column)={width=200} pour modifier largeur colonne à la mano */&lt;BR /&gt;
			WHERE &amp;amp;MyCondition;&lt;BR /&gt;
		Run;&lt;BR /&gt;
 &lt;BR /&gt;
		Proc DELETE DATA=temp; Run;&lt;BR /&gt;
	%End;&lt;BR /&gt;
%Mend;&lt;BR /&gt;
&lt;BR /&gt;
And it works.&lt;BR /&gt;
&lt;BR /&gt;
The (if org) clause is very interesting, equivalent to org ne 0 and org ne .&lt;BR /&gt;
&lt;BR /&gt;
Thanks.&lt;BR /&gt;
&lt;BR /&gt;
phil</description>
      <pubDate>Mon, 19 Apr 2010 16:13:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-macro-parameter-expression-containing/m-p/75668#M16311</guid>
      <dc:creator>phil27</dc:creator>
      <dc:date>2010-04-19T16:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with macro parameter expression containing .</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-macro-parameter-expression-containing/m-p/75669#M16312</link>
      <description>weird&lt;BR /&gt;
   &lt;BR /&gt;
&amp;gt; %IF (%Eval(&amp;amp;Nb)&amp;gt;0) OR (%Eval(&amp;amp;MyAffichePasSiZero) ne&lt;BR /&gt;
  &lt;BR /&gt;
why does it need these %EVAL() calls</description>
      <pubDate>Mon, 19 Apr 2010 16:41:33 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-macro-parameter-expression-containing/m-p/75669#M16312</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-04-19T16:41:33Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with macro parameter expression containing .</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-macro-parameter-expression-containing/m-p/75670#M16313</link>
      <description>Hi,&lt;BR /&gt;
to evaluate the value of &amp;amp;Nb and &amp;amp;MyAffichePasSiZero.&lt;BR /&gt;
&lt;BR /&gt;
It is not necessary ?&lt;BR /&gt;
&lt;BR /&gt;
Phil</description>
      <pubDate>Tue, 20 Apr 2010 06:58:53 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-macro-parameter-expression-containing/m-p/75670#M16313</guid>
      <dc:creator>phil27</dc:creator>
      <dc:date>2010-04-20T06:58:53Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with macro parameter expression containing .</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-macro-parameter-expression-containing/m-p/75671#M16314</link>
      <description>On reading macro doc in the past (iirc) I have seen statements like "%if implicitly performs a %eval". &lt;BR /&gt;
Unless you have introduced the complexity of macro quoting (which defers resolving a macro expression), a reference to a macro variable will be resolved/evaluated when found by the macro compiler.&lt;BR /&gt;
This points at one way that might require these %eval() - where the macro variable referred like [pre]     %eval(&amp;amp;macroVariable) [/pre] contains text that might confuse the %if logical expression. However, I think that might cause the %eval() to fail anyway. If such contents in a macro variable might need the isolation of its evaluation that %eval() provides then the parentheses, without %eval, would be sufficient, like [pre]   %if (&amp;amp;Nb)&amp;gt;0 OR (&amp;amp;MyAffichePasSiZero) ne 1  %then [/pre]&lt;BR /&gt;
So, what kind of values might be found in &amp;amp;Nb and &amp;amp;MyAffichePasSiZero?&lt;BR /&gt;
 &lt;BR /&gt;
PeterC</description>
      <pubDate>Tue, 20 Apr 2010 08:50:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-macro-parameter-expression-containing/m-p/75671#M16314</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-04-20T08:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with macro parameter expression containing .</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-macro-parameter-expression-containing/m-p/75672#M16315</link>
      <description>Thanks,&lt;BR /&gt;
Only numeric integer values can be found for both &amp;amp;Nb and &amp;amp;MyAffichePasSiZero.&lt;BR /&gt;
&lt;BR /&gt;
Phil.</description>
      <pubDate>Tue, 20 Apr 2010 08:59:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-macro-parameter-expression-containing/m-p/75672#M16315</guid>
      <dc:creator>phil27</dc:creator>
      <dc:date>2010-04-20T08:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with macro parameter expression containing .</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-macro-parameter-expression-containing/m-p/75673#M16316</link>
      <description>then they do'nt need to be wrapped with %eval()</description>
      <pubDate>Tue, 20 Apr 2010 09:41:41 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-macro-parameter-expression-containing/m-p/75673#M16316</guid>
      <dc:creator>Peter_C</dc:creator>
      <dc:date>2010-04-20T09:41:41Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with macro parameter expression containing .</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Issue-with-macro-parameter-expression-containing/m-p/75674#M16317</link>
      <description>Okay thanks Peter.</description>
      <pubDate>Tue, 20 Apr 2010 09:43:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Issue-with-macro-parameter-expression-containing/m-p/75674#M16317</guid>
      <dc:creator>phil27</dc:creator>
      <dc:date>2010-04-20T09:43:05Z</dc:date>
    </item>
  </channel>
</rss>

