<?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: Are macro variables supported as input of SAS/IML modules and routines? in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951045#M6371</link>
    <description>&lt;P&gt;Now I see where the problem seems to be. The entire but the last few entires of the vector of results (i.e., the CDF's I wish to calculate) are in fact 1.&lt;/P&gt;
&lt;P&gt;For instance, one of the calculations is as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;a=1817.9997;
b=38.043169;
gamma=cdf('GAMMA',a,b);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But given that I had pre-emptively filled the vector gamma with a batch of 1's with the J function, I was not able to discover that SAS had already conducted calculations on some of the entires. Setting the default values to 0 or missing helps me make this discovery.&lt;/P&gt;
&lt;P&gt;But the last few entries of&amp;nbsp;&lt;STRONG&gt;up&amp;nbsp;&lt;/STRONG&gt;and&amp;nbsp;&lt;STRONG&gt;p&amp;nbsp;&lt;/STRONG&gt;contained negative values, which is why SAS kept reporting errors. I will go through my code and search for reasons of the appearance of negative values.&lt;/P&gt;</description>
    <pubDate>Mon, 18 Nov 2024 02:24:03 GMT</pubDate>
    <dc:creator>Season</dc:creator>
    <dc:date>2024-11-18T02:24:03Z</dc:date>
    <item>
      <title>Are macro variables supported as input of SAS/IML modules and routines?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951013#M6358</link>
      <description>&lt;P&gt;I am conducting numerical integration (or more specifically, calculating the value of incomplete gamma function) via the QUAD routine of SAS/IML. Given that I have a batch of functions to evaluate, I composed a macro in which the integrand is defined repetitively via a module, like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro fun;
%do i=1 %to 2;
p&amp;amp;i.=p[&amp;amp;i.];/*p is a vector housing variables closely connected to the power of one of the terms of the integrand of the incomplete gamma function*/
p&amp;amp;i.a=p&amp;amp;i.-1;
start fun(u);
y=u**(eval(1*p&amp;amp;i.a))*exp(-u);/*incomplete gamma function*/
return (y);
finish;
a=j(1,1,0)||up[&amp;amp;i.];/*up is a vector of the upper limits of integration calculated previously*/
call quad(g&amp;amp;i.,'fun',a);
%end;
%mend;
proc iml;
%fun;
print g1 g2;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Only two loops were written in the macro %fun for I was troubleshooting. In practice, more loops are needed.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, the SAS log reports that g1 and g2 had not been set to values. I read the log carefully and found a message:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;p1a      0 row       0 col     (type ?, size 0)
p2a      0 row       0 col     (type ?, size 0)&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;So it seems that the scalars named p1a and p2a and served as the power of the independent variable of one of the terms of the integrand of the incomplete gamma function did not pass to either the fun module or the QUAD routine. Of course, it might also be the case that the value was passed to none of them.&lt;/P&gt;
&lt;P&gt;Given that a do loop is not acceptable in a module of SAS/IML (I tried this method yesterday and it is because of this that I attempted to compose this macro), what should I do next?&lt;/P&gt;
&lt;P&gt;Many thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Nov 2024 10:50:54 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951013#M6358</guid>
      <dc:creator>Season</dc:creator>
      <dc:date>2024-11-17T10:50:54Z</dc:date>
    </item>
    <item>
      <title>Re: Are macro variables supported as input of SAS/IML modules and routines?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951014#M6359</link>
      <description>&lt;P&gt;Short answer: Yes they are. However, your code contains some errors:&lt;/P&gt;
&lt;P&gt;1. There is not any function called EVAL in IML. You might be intending to use %EVAL, but that macro isn't necessary&lt;/P&gt;
&lt;P&gt;2. If you want to pass parameters to the integrated used in the QUAD routine, you need to use the GLOBAL clause.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;Given that a do loop is not acceptable in a module of SAS/IML, what should I do next?&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;This statement is false. What you should do is use the IML language instead of macro loops. An IML program rarely requires a macro loop because the language supports loops and arrays.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think you are asking how to write one integrated function that can be used in a loop to integrate a sequence of functions. For each call, you want the parameter and the upper bound of integration to vary according to values in some array.&amp;nbsp; Please study the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
/* loop over parameters and upper bounds for integration */
start fun(u) global(g_alpha);
   y=u**(g_alpha-1)*exp(-u);/*incomplete gamma function*/
   return (y);
finish;

up = {3, 4, 5};
p = {1.1, 2.2, 0.8};
IncGamma = j(nrow(p), 1,.);
do i = 1 to nrow(p);
   g_alpha = p[I];   /* copy parameter into a global variable to the integrand */
   call quad(g, "fun", 0 || up[I]);  /* set the domain of integration */
   IncGamma[i] = g;  /* copy the answer into a vector */
end;

print p up IncGamma;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;If I may make a suggestion, you don't need to use the QUAD function to solve this problem. Mathematically, the integral you are trying to compute is related to the CDF of the gamma distribution, which is built into SAS. Thus, you can solve your problem by using the following :&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
/* it's not necessary to call QUAD; use the CDF of the gamma distribution.
   See https://blogs.sas.com/content/iml/2021/01/25/incomplete-gamma-function-sas.html*/
start LowerIncGamma(x, alpha); /* lower incomplete gamma function */
   return Gamma(alpha) # CDF('Gamma', x, alpha);
finish;

up = {3, 4, 5};
p = {1.1, 2.2, 0.8};
IncGamma2 = LowerIncGamma(up, p); 
print p up IncGamma2;
&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Some references:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;GLOBAL clause:&amp;nbsp;&lt;A href="https://blogs.sas.com/content/iml/2010/10/27/evaluate-an-iterated-integral.html" target="_blank"&gt;Evaluate an iterated integral in SAS&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://blogs.sas.com/content/iml/2021/01/25/incomplete-gamma-function-sas.html" target="_blank"&gt;How to compute the incomplete gamma function in SAS - The DO Loop&lt;/A&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;A href="https://blogs.sas.com/content/iml/2013/06/19/macros-and-loops.html" target="_blank"&gt;Macros and loops in the SAS/IML language - The DO Loop&lt;/A&gt;&lt;/LI&gt;
&lt;/UL&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Nov 2024 11:29:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951014#M6359</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2024-11-17T11:29:34Z</dc:date>
    </item>
    <item>
      <title>Re: Are macro variables supported as input of SAS/IML modules and routines?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951016#M6360</link>
      <description>&lt;P&gt;Thank you, Rick, for your rapid, detailed and helpful reply! It takes me time to digest the information you provided in your thread. However, there is one issue that I can point out:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;wrote:
&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;Given that a do loop is not acceptable in a module of SAS/IML, what should I do next?&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;This statement is false. What you should do is use the IML language instead of macro loops. An IML program rarely requires a macro loop because the language supports loops and arrays.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I made a mistake in my post. The correct message to convey is "building modules are not supported in a do loop". For instance, the following code makes SAS report an error in the log:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
do i=1 to 10;
start fun(u);
y=u**2;
return(y);
finish;
end;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I will post my questions if there are any after reading your reply carefully. Thanks!&lt;/P&gt;</description>
      <pubDate>Sun, 17 Nov 2024 13:00:56 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951016#M6360</guid>
      <dc:creator>Season</dc:creator>
      <dc:date>2024-11-17T13:00:56Z</dc:date>
    </item>
    <item>
      <title>Re: Are macro variables supported as input of SAS/IML modules and routines?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951019#M6362</link>
      <description>&lt;P&gt;Poor example, why would you want to define the same function 10 times?&lt;/P&gt;
&lt;P&gt;But dynamically generating the code that defines a function is not part of the language. Or really of much value since normally if you want a function to behave differently you give it different inputs.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However if you did need to build something were the definition of a function changes then just use some type of code generation.&amp;nbsp; Such as macro code or call execute() or writing the code to a file and using %INCLUDE.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Nov 2024 14:48:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951019#M6362</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2024-11-17T14:48:30Z</dc:date>
    </item>
    <item>
      <title>Re: Are macro variables supported as input of SAS/IML modules and routines?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951021#M6363</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Poor example, why would you want to define the same function 10 times?&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The original code I composed revolved around the incomplete gamma function. As the integrand varied from iteration to iteration and I was unaware of the correct usage of the GLOBAL option of the START statement before I consulted&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;, I tried to use the do loop to define the function differently in each loop, but I failed and therefore deleted the original code. I did not want to spend time on recalling and typing the real code I used before, so I generated the same function again and again. I think this is not a major concern to focus on. The real major concern is that building modules are not supported in the DO loop, an issue that seems to have been overlooked by IML textbooks, as least the one I referred to. Therefore, I wrote down my experience to alert to readers who may be willing to adopt a similar approach.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt;&amp;nbsp;wrote:
&lt;P&gt;However if you did need to build something were the definition of a function changes then just use some type of code generation.&amp;nbsp; Such as macro code or call execute() or writing the code to a file and using %INCLUDE.&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;gave an example of the GLOBAL option. I think that is good enough. I had just read a blog by&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13684"&gt;@Rick_SAS&lt;/a&gt;&amp;nbsp;(&lt;A href="https://blogs.sas.com/content/iml/2013/06/19/macros-and-loops.html" target="_blank"&gt;Macros and loops in the SAS/IML language - The DO Loop&lt;/A&gt;) in which he said that he did not support using macros in SAS/IML that much. Neither do I. I am not that familiar with macros.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Nov 2024 15:07:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951021#M6363</guid>
      <dc:creator>Season</dc:creator>
      <dc:date>2024-11-17T15:07:19Z</dc:date>
    </item>
    <item>
      <title>Re: Are macro variables supported as input of SAS/IML modules and routines?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951022#M6364</link>
      <description>&lt;P&gt;I read your blog and found that given there was an extra Γ(p) term to divide after I compute the incomplete gamma function, the whole thing I had been calculating was nothing but the cumulative distribution function (CDF) of Γ(up,p). I tried the numerical integration method by the QUAD routine first and found out that for small values of p, the QUAD routine failed potentially as a result of lack of specification of the SCALE= option. I therefore read your blog and found out the conclusion I gave at the beginning of this thread.&lt;/P&gt;
&lt;P&gt;Still, I encountered a problem when I was actually computing the CDF's. I directly applied the CDF function element-wise and found an error. The code looked like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
Gamma=j(nrow(p),1,1);
up = {3, 4, 5};
p = {1.1, 2.2, 0.8};
do i=1 to nrow(p);
Gamma[i]=cdf('gamma',up[i],p[i]);
end;
print p up Gamma;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The code failed. The log read:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ERROR: (execution) Invalid argument to function.

 operation : CDF at line 358 column 9
 operands  : *LIT1008, _TEM1001, _TEM1002

*LIT1008      1 row       1 col     (character, size 5)

 gamma

_TEM1001      1 row       1 col     (numeric)

 -2.326E19

_TEM1002      1 row       1 col     (numeric)

 -4.868E17

 statement : ASSIGN at line 358 column 1&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Why is it the case?&lt;/P&gt;</description>
      <pubDate>Sun, 17 Nov 2024 16:01:35 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951022#M6364</guid>
      <dc:creator>Season</dc:creator>
      <dc:date>2024-11-17T16:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: Are macro variables supported as input of SAS/IML modules and routines?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951028#M6365</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;The real major concern is that building modules are not supported in the DO loop, an issue that seems to have been overlooked by IML textbooks, as least the one I referred to.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I would be interested to learn the names of the IML textbooks that you consulted.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Some of my writings about SAS/IML modules are compiled in the article, &lt;A href="https://blogs.sas.com/content/iml/2015/06/17/everything-about-modules.html" target="_blank"&gt;https://blogs.sas.com/content/iml/2015/06/17/everything-about-modules.html,&lt;/A&gt;&lt;BR /&gt;which states, 'All&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A href="https://blogs.sas.com/content/iml/2014/04/21/local-functions-not-in-the-sasiml-langauge.html" target="_self"&gt;modules are global in scope&lt;/A&gt;. The SAS/IML language does not support "hidden modules" or "local modules" or "nested modules."'&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 17 Nov 2024 21:01:50 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951028#M6365</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2024-11-17T21:01:50Z</dc:date>
    </item>
    <item>
      <title>Re: Are macro variables supported as input of SAS/IML modules and routines?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951029#M6366</link>
      <description>&lt;P&gt;&lt;EM&gt;&amp;gt;&amp;nbsp;Why is it the case?&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;In your program, you have not yet defined the p vector when you attempt to allocate the Gamma vector. In the first line&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Gamma=j(nrow(p),1,1);&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;the expression nrow(p) evaluates to 0. Therefore the vector has "zero rows."&amp;nbsp; Inside the DO loop, the expression Gamma[I] gives an error because the subscript Gamma[1] is invalid.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Solution: Move the line&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;STRONG&gt;Gamma=j(nrow(p),1,1);&lt;/STRONG&gt;&lt;/P&gt;
&lt;P&gt;to the third line in the program, not the first.&lt;/P&gt;</description>
      <pubDate>Sun, 17 Nov 2024 21:07:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951029#M6366</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2024-11-17T21:07:11Z</dc:date>
    </item>
    <item>
      <title>Re: Are macro variables supported as input of SAS/IML modules and routines?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951036#M6367</link>
      <description>&lt;P&gt;Ah, yes... That's a mistake that shouldn't had been make... But the problem lingers after I rearranged the sequence of codes. The error-reporting log was similar to the one I posted earlier. It still said there was an invalid argument to function. So, ..., why is the case now?&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2024 00:55:11 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951036#M6367</guid>
      <dc:creator>Season</dc:creator>
      <dc:date>2024-11-18T00:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: Are macro variables supported as input of SAS/IML modules and routines?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951041#M6368</link>
      <description>&lt;P&gt;I have just finished reading the book &lt;A href="https://link.springer.com/book/10.1007/978-1-4419-5557-9" target="_blank"&gt;A SAS/IML Companion for Linear Models | SpringerLink&lt;/A&gt;&amp;nbsp;from cover to cover. That is the only IML textbook I have read till now. I had known that you had written an IML book. But by the time I was selecting which book to read, I was not in a dire need for the software. I learned it because I wished to have more "knowledge (or technology) reserve" in response to demanding requests that may be proposed by reviewers after submission of my research papers to journals. Given that your book was thicker, I chose the book with less pages.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2024 01:15:06 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951041#M6368</guid>
      <dc:creator>Season</dc:creator>
      <dc:date>2024-11-18T01:15:06Z</dc:date>
    </item>
    <item>
      <title>Re: Are macro variables supported as input of SAS/IML modules and routines?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951043#M6369</link>
      <description>&lt;P&gt;I cannot guess what your code looks like. The following works:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
up = {3, 4, 5};
p = {1.1, 2.2, 0.8};
Gamma=j(nrow(p),1,1);
do i=1 to nrow(p);
   Gamma[i]=cdf('gamma',up[i],p[i]);
end;
print p up Gamma;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 18 Nov 2024 01:39:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951043#M6369</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2024-11-18T01:39:39Z</dc:date>
    </item>
    <item>
      <title>Re: Are macro variables supported as input of SAS/IML modules and routines?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951044#M6370</link>
      <description>&lt;P&gt;That's interesting. My code exactly looks like the one you provided but it still kept failing. I will copy my log once again.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;ERROR: (execution) Invalid argument to function.

 operation : CDF at line 180 column 9
 operands  : *LIT1009, _TEM1001, _TEM1002

*LIT1009      1 row       1 col     (character, size 5)

 GAMMA

_TEM1001      1 row       1 col     (numeric)

 -2.326E19

_TEM1002      1 row       1 col     (numeric)

 -4.868E17

 statement : ASSIGN at line 180 column 1&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I looked at the entries of &lt;STRONG&gt;up&lt;/STRONG&gt; and &lt;STRONG&gt;p&lt;/STRONG&gt; and found minuscule numbers at the end of the two vectors (e.g.,1.4066E19). Is it because of the presence of the letter "E" that causes the CDF function to falsely identify it as a character variable and the consequent failure of the code?&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2024 02:04:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951044#M6370</guid>
      <dc:creator>Season</dc:creator>
      <dc:date>2024-11-18T02:04:45Z</dc:date>
    </item>
    <item>
      <title>Re: Are macro variables supported as input of SAS/IML modules and routines?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951045#M6371</link>
      <description>&lt;P&gt;Now I see where the problem seems to be. The entire but the last few entires of the vector of results (i.e., the CDF's I wish to calculate) are in fact 1.&lt;/P&gt;
&lt;P&gt;For instance, one of the calculations is as follows:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;a=1817.9997;
b=38.043169;
gamma=cdf('GAMMA',a,b);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;But given that I had pre-emptively filled the vector gamma with a batch of 1's with the J function, I was not able to discover that SAS had already conducted calculations on some of the entires. Setting the default values to 0 or missing helps me make this discovery.&lt;/P&gt;
&lt;P&gt;But the last few entries of&amp;nbsp;&lt;STRONG&gt;up&amp;nbsp;&lt;/STRONG&gt;and&amp;nbsp;&lt;STRONG&gt;p&amp;nbsp;&lt;/STRONG&gt;contained negative values, which is why SAS kept reporting errors. I will go through my code and search for reasons of the appearance of negative values.&lt;/P&gt;</description>
      <pubDate>Mon, 18 Nov 2024 02:24:03 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/Are-macro-variables-supported-as-input-of-SAS-IML-modules-and/m-p/951045#M6371</guid>
      <dc:creator>Season</dc:creator>
      <dc:date>2024-11-18T02:24:03Z</dc:date>
    </item>
  </channel>
</rss>

