BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
hellohere
Pyrite | Level 9

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) ;

1 ACCEPTED SOLUTION

Accepted Solutions
Rick_SAS
SAS Super FREQ

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." 

View solution in original post

3 REPLIES 3
hellohere
Pyrite | Level 9
ok
Rick_SAS
SAS Super FREQ

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." 

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

From The DO Loop
Want more? Visit our blog for more articles like these.
Discussion stats
  • 3 replies
  • 1292 views
  • 0 likes
  • 3 in conversation