<?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: sas macro does not output the correct values in SAS Procedures</title>
    <link>https://communities.sas.com/t5/SAS-Procedures/sas-macro-does-not-output-the-correct-values/m-p/226807#M54112</link>
    <description>Also, macro variables declared inside an array are local to the macro, they disappear when the macro ends. Create a global set of macro variables first and you shouldn't have that issue.&lt;BR /&gt;&lt;BR /&gt;%global j m r s;</description>
    <pubDate>Tue, 22 Sep 2015 20:35:43 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2015-09-22T20:35:43Z</dc:date>
    <item>
      <title>sas macro does not output the correct values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/sas-macro-does-not-output-the-correct-values/m-p/226803#M54110</link>
      <description>&lt;P&gt;Hi, can you please tell me what is wrong with my code? I get the following error when I run it:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="2"&gt;WARNING: Apparent symbolic reference J not resolved.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;547 %put &amp;amp;j;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;&amp;amp;j&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;548 %put &amp;amp;m;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;WARNING: Apparent symbolic reference M not resolved.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;&amp;amp;m&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;549 %put &amp;amp;r;&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;WARNING: Apparent symbolic reference R not resolved.&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;&amp;amp;r&lt;/FONT&gt;&lt;BR /&gt;&lt;FONT size="2"&gt;550 %put &amp;amp;s;&lt;/FONT&gt;&lt;BR /&gt;WARNING: Apparent symbolic reference S not resolved.&lt;BR /&gt;&amp;amp;s&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT size="4"&gt;&lt;STRONG&gt;Here is my code:&amp;nbsp;&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%LET alp=0.05;&lt;BR /&gt;%LET nn=30;&lt;BR /&gt;%LET side=twosided;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;%macro calc(alp,nn,side);&lt;BR /&gt;%let side=%upcase(&amp;amp;side);&lt;BR /&gt;%if &amp;amp;side=TWOSIDED %then %do;&lt;BR /&gt;%let p1=%sysevalf(&amp;amp;alp/2);&lt;BR /&gt;%end;&lt;BR /&gt;%else %do; %let p1=&amp;amp;alp; %end;&lt;BR /&gt;%let p2=%sysevalf(1-&amp;amp;p1);&lt;BR /&gt;%let np1=%sysevalf(&amp;amp;nn*&amp;amp;p1);&lt;BR /&gt;%let np2=%sysevalf(&amp;amp;nn*&amp;amp;p2);&lt;BR /&gt;%LET m=%sysevalf(&amp;amp;np2,floor);&lt;BR /&gt;%if %sysevalf(&amp;amp;np1,floor)=0 %then %do;&lt;BR /&gt;%let j=1; %end;&lt;BR /&gt;%else %do;&lt;BR /&gt;%let j=%sysevalf((&amp;amp;np1,floor); %end;&lt;BR /&gt;%let r=%sysevalf(&amp;amp;np1+1,floor);&lt;BR /&gt;%let s=%sysevalf(&amp;amp;np2+1,floor);&lt;BR /&gt;data getit;&lt;BR /&gt;j=&amp;amp;j;&lt;BR /&gt;m=&amp;amp;m;&lt;BR /&gt;r=&amp;amp;r;&lt;BR /&gt;s=&amp;amp;s;&lt;BR /&gt;run;&lt;BR /&gt;%mend calc;&lt;BR /&gt;%calc(alp=&amp;amp;alp,nn=&amp;amp;nn,side=&amp;amp;side);&lt;BR /&gt;%put &amp;amp;j;&lt;BR /&gt;%put &amp;amp;m;&lt;BR /&gt;%put &amp;amp;r;&lt;BR /&gt;%put &amp;amp;s;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Tue, 22 Sep 2015 20:03:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/sas-macro-does-not-output-the-correct-values/m-p/226803#M54110</guid>
      <dc:creator>statz</dc:creator>
      <dc:date>2015-09-22T20:03:03Z</dc:date>
    </item>
    <item>
      <title>Re: sas macro does not output the correct values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/sas-macro-does-not-output-the-correct-values/m-p/226806#M54111</link>
      <description>Without reading thoroughly or much, comparisons tend to be case sensitive, ie twosided IS NOT EQUAL to TWOSIDED</description>
      <pubDate>Tue, 22 Sep 2015 20:29:05 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/sas-macro-does-not-output-the-correct-values/m-p/226806#M54111</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-09-22T20:29:05Z</dc:date>
    </item>
    <item>
      <title>Re: sas macro does not output the correct values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/sas-macro-does-not-output-the-correct-values/m-p/226807#M54112</link>
      <description>Also, macro variables declared inside an array are local to the macro, they disappear when the macro ends. Create a global set of macro variables first and you shouldn't have that issue.&lt;BR /&gt;&lt;BR /&gt;%global j m r s;</description>
      <pubDate>Tue, 22 Sep 2015 20:35:43 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/sas-macro-does-not-output-the-correct-values/m-p/226807#M54112</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2015-09-22T20:35:43Z</dc:date>
    </item>
    <item>
      <title>Re: sas macro does not output the correct values</title>
      <link>https://communities.sas.com/t5/SAS-Procedures/sas-macro-does-not-output-the-correct-values/m-p/226884#M54116</link>
      <description>&lt;P&gt;Thanks Reeza! I put the&amp;nbsp;&lt;SPAN&gt;%global j m r s;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;and it worked!&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks a lot! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2015 12:37:20 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Procedures/sas-macro-does-not-output-the-correct-values/m-p/226884#M54116</guid>
      <dc:creator>statz</dc:creator>
      <dc:date>2015-09-23T12:37:20Z</dc:date>
    </item>
  </channel>
</rss>

