Inside of PROC IML, function/module can be stored and loaded. But one quest, what if two function with identical
name but with different set of parameters, does that cause problem?! Must take changed name to differentialize
them or any other way out?!
store module=mymod1; /* store module MYMOD1 */
LOAD MODULE=
(modules) ;
You cannot define two modules that have the same name and different parameters. The second definition will overwrite the first. Or if you use the LOAD statement, the module that is stored will overwrite the current definition.
You can use define a module to have optional arguments that take on default values when they are not specified. For example,
/* return 1 if x[i] is within eps of y[i] for all i */
start IsEqual(x, y, eps=1e-6);
return( all( abs(x-y)<=eps) );
finish;
You can call the module as
b = IsEqual(x, y); /* Default: compare within 1e-6 */
or you can specify the third argument as follows:
b2 = IsEqual(x, y, 1e-12); /* compare within 1e-12 */
For more information on default and optional arguments in SAS/IML modules, see the section "Optional parameters and default values" in the article "Everything you wanted to know about writing SAS/IML modules."
You cannot define two modules that have the same name and different parameters. The second definition will overwrite the first. Or if you use the LOAD statement, the module that is stored will overwrite the current definition.
You can use define a module to have optional arguments that take on default values when they are not specified. For example,
/* return 1 if x[i] is within eps of y[i] for all i */
start IsEqual(x, y, eps=1e-6);
return( all( abs(x-y)<=eps) );
finish;
You can call the module as
b = IsEqual(x, y); /* Default: compare within 1e-6 */
or you can specify the third argument as follows:
b2 = IsEqual(x, y, 1e-12); /* compare within 1e-12 */
For more information on default and optional arguments in SAS/IML modules, see the section "Optional parameters and default values" in the article "Everything you wanted to know about writing SAS/IML modules."
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!
Learn how to run multiple linear regression models with and without interactions, presented by SAS user Alex Chaplin.
Find more tutorials on the SAS Users YouTube channel.