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: Save the Date

 SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!

Save the date!

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
  • 751 views
  • 0 likes
  • 3 in conversation