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

SAS Innovate 2025: Call for Content

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!

Submit your idea!

Multiple Linear Regression in SAS

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.

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