<?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 ( ctr , num) in SAS Studio</title>
    <link>https://communities.sas.com/t5/SAS-Studio/macro-ctr-num/m-p/474302#M5830</link>
    <description>&lt;P&gt;Thank you&amp;nbsp; for your&amp;nbsp; answer&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 28 Jun 2018 23:12:22 GMT</pubDate>
    <dc:creator>IBNANA</dc:creator>
    <dc:date>2018-06-28T23:12:22Z</dc:date>
    <item>
      <title>%macro ( ctr , num)</title>
      <link>https://communities.sas.com/t5/SAS-Studio/macro-ctr-num/m-p/473641#M5823</link>
      <description>&lt;P&gt;I have a question on the use of %macro. I am&amp;nbsp;using the code of a published paper to build my own indicator&amp;nbsp; and I faced many&amp;nbsp; problems.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Code : &amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;%macro decomp(ctr,num);&lt;BR /&gt;proc iml;&lt;BR /&gt;use vbs;&lt;BR /&gt;read all var _all_ into vbs;&lt;BR /&gt;use texpfd(drop = ctr sec domdmd texpfd) ;&lt;BR /&gt;read all var _all_ into expf;&lt;BR /&gt;/*make DVAsh to zero */&lt;BR /&gt;k = 0;&lt;BR /&gt;do i = 1 to 1435 by 35;&lt;BR /&gt;&amp;nbsp; j = i+34;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; k = k + 1;&lt;BR /&gt;rows = i:j;&lt;BR /&gt;cols = k:k;&lt;BR /&gt;vbs[rows,cols] = 0;&lt;BR /&gt;end;&lt;BR /&gt;indvaexp=vbs[,&amp;amp;num]#expf;&lt;/DIV&gt;&lt;DIV&gt;quit;&lt;/DIV&gt;&lt;DIV&gt;%mend decomp&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;my problem is&amp;nbsp; %macro (ctr ,num)&amp;nbsp; . Is num refering to the fact that it is a numeric variable ?&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;and the last code&amp;nbsp;&lt;SPAN&gt;indvaexp=vbs[,&amp;amp;num]#expf. What is the meaning of vbs[,&amp;amp;num] . I know that we use &amp;amp; to make reference to a macro variable but I tried to compute without macro (&amp;nbsp;indvaexp=vbs#expf) but I don't get the same result .&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;Can you help me please ?&lt;/SPAN&gt;&lt;/DIV&gt;</description>
      <pubDate>Wed, 27 Jun 2018 09:05:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/macro-ctr-num/m-p/473641#M5823</guid>
      <dc:creator>IBNANA</dc:creator>
      <dc:date>2018-06-27T09:05:56Z</dc:date>
    </item>
    <item>
      <title>Re: %macro ( ctr , num)</title>
      <link>https://communities.sas.com/t5/SAS-Studio/macro-ctr-num/m-p/473659#M5824</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro decomp(ctr,num);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here, num is just defined as the second positional parameter of the macro. You can reference it just like any locally defined macro variable throughout the macro.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;indvaexp=vbs[,&amp;amp;num]#expf;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Here &amp;amp;num is referenced. When the macro resolves and is executed by the macro preprocessor, &amp;amp;num is replaced by whatever was supplied as a parameter when the macro was called.&lt;/P&gt;
&lt;P&gt;eg&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%decomp(x,y)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;will resolve this particular line to&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;indvaexp=vbs[,y]#expf;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Think of the macro preprocessor as a quite versatile text replacement tool.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2018 10:50:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/macro-ctr-num/m-p/473659#M5824</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2018-06-27T10:50:23Z</dc:date>
    </item>
    <item>
      <title>Re: %macro ( ctr , num)</title>
      <link>https://communities.sas.com/t5/SAS-Studio/macro-ctr-num/m-p/473764#M5826</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/217980"&gt;@IBNANA&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;I have a question on the use of %macro. I am&amp;nbsp;using the code of a published paper to build my own indicator&amp;nbsp; and I faced many&amp;nbsp; problems.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Code : &amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;DIV&gt;%macro decomp(ctr,num);&lt;BR /&gt;proc iml;&lt;BR /&gt;use vbs;&lt;BR /&gt;read all var _all_ into vbs;&lt;BR /&gt;use texpfd(drop = ctr sec domdmd texpfd) ;&lt;BR /&gt;read all var _all_ into expf;&lt;BR /&gt;/*make DVAsh to zero */&lt;BR /&gt;k = 0;&lt;BR /&gt;do i = 1 to 1435 by 35;&lt;BR /&gt;&amp;nbsp; j = i+34;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp; k = k + 1;&lt;BR /&gt;rows = i:j;&lt;BR /&gt;cols = k:k;&lt;BR /&gt;vbs[rows,cols] = 0;&lt;BR /&gt;end;&lt;BR /&gt;indvaexp=vbs[,&amp;amp;num]#expf;&lt;/DIV&gt;
&lt;DIV&gt;quit;&lt;/DIV&gt;
&lt;DIV&gt;%mend decomp&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;my problem is&amp;nbsp; %macro (ctr ,num)&amp;nbsp; . Is num refering to the fact that it is a numeric variable ?&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;and the last code&amp;nbsp;&lt;SPAN&gt;indvaexp=vbs[,&amp;amp;num]#expf. What is the meaning of vbs[,&amp;amp;num] . I know that we use &amp;amp; to make reference to a macro variable but I tried to compute without macro (&amp;nbsp;indvaexp=vbs#expf) but I don't get the same result .&amp;nbsp;&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;
&lt;DIV&gt;&lt;SPAN&gt;Can you help me please ?&lt;/SPAN&gt;&lt;/DIV&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;If the paper you reference that gave you the base code did not document the usage of any of the macro parameters I would hesitate to rely on the paper or the code too much.&lt;/P&gt;
&lt;P&gt;Especially if there are no validations of the parameters in regards to the data or code use. Any program should document the expected inputs somewhere such as a comment block. It should have some explanation of what the whole macro does and details of the macro parameters and if there isn't any validation of the parameter values then the validation you have to perform before using the macro.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Something of concern: there macro parameter CTR is apparently not even used. I would expect to see at least one reference to &amp;amp;ctr in the code.&lt;/P&gt;</description>
      <pubDate>Wed, 27 Jun 2018 14:44:49 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/macro-ctr-num/m-p/473764#M5826</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2018-06-27T14:44:49Z</dc:date>
    </item>
    <item>
      <title>Re: %macro ( ctr , num)</title>
      <link>https://communities.sas.com/t5/SAS-Studio/macro-ctr-num/m-p/474302#M5830</link>
      <description>&lt;P&gt;Thank you&amp;nbsp; for your&amp;nbsp; answer&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 28 Jun 2018 23:12:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Studio/macro-ctr-num/m-p/474302#M5830</guid>
      <dc:creator>IBNANA</dc:creator>
      <dc:date>2018-06-28T23:12:22Z</dc:date>
    </item>
  </channel>
</rss>

