Short answer: Yes they are. However, your code contains some errors:
1. There is not any function called EVAL in IML. You might be intending to use %EVAL, but that macro isn't necessary
2. If you want to pass parameters to the integrated used in the QUAD routine, you need to use the GLOBAL clause.
> Given that a do loop is not acceptable in a module of SAS/IML, what should I do next?
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.
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. Please study the following:
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;
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 :
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;
Some references:
GLOBAL clause: Evaluate an iterated integral in SAS
How to compute the incomplete gamma function in SAS - The DO Loop
Macros and loops in the SAS/IML language - The DO Loop
... View more