<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: In IML, is it possible to pass a function name as argument to other functions? in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/In-IML-is-it-possible-to-pass-a-function-name-as-argument-to/m-p/406614#M3795</link>
    <description>&lt;P&gt;Yes, I see.&amp;nbsp; I did not know of either of these two strategies.&amp;nbsp; Perfectly clear answer with your examples.&amp;nbsp; Thanks very much for the information.&amp;nbsp; A great help.&lt;/P&gt;</description>
    <pubDate>Mon, 23 Oct 2017 16:15:21 GMT</pubDate>
    <dc:creator>_bc_</dc:creator>
    <dc:date>2017-10-23T16:15:21Z</dc:date>
    <item>
      <title>In IML, is it possible to pass a function name as argument to other functions?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/In-IML-is-it-possible-to-pass-a-function-name-as-argument-to/m-p/406589#M3792</link>
      <description>&lt;P&gt;I want to pass the name of a function to another function as an argument in IML.&amp;nbsp; Is this possible? I'm running V9.4&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;

   start try1(x,y);
   return(x+y);
   finish;

   start try2(x,y);
   return (x*y);
   finish;

   start calc(x,y,func);
   return ( func(x,y) );
   finish;

  x=2; y=3;
  a = calc(x,y,"try1"); print a;
  b = calc(x,y,"try2"); print b;

quit;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Oct 2017 15:27:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/In-IML-is-it-possible-to-pass-a-function-name-as-argument-to/m-p/406589#M3792</guid>
      <dc:creator>_bc_</dc:creator>
      <dc:date>2017-10-23T15:27:13Z</dc:date>
    </item>
    <item>
      <title>Re: In IML, is it possible to pass a function name as argument to other functions?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/In-IML-is-it-possible-to-pass-a-function-name-as-argument-to/m-p/406593#M3793</link>
      <description>&lt;P&gt;Maybe. It depends what you are trying to do. Look at &lt;A href="http://go.documentation.sas.com/?docsetId=imlug&amp;amp;docsetTarget=imlug_langref_sect060.htm&amp;amp;docsetVersion=14.3&amp;amp;locale=en" target="_self"&gt;the APPLY function&lt;/A&gt;, which solves your trivial example.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
   start try1(x,y);
   return(x+y);
   finish;

   start try2(x,y);
   return (x*y);
   finish;

  x=2; y=3;
  a = apply("try1", x,y); print a;
  b = apply("try2", x,y); print b;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Oct 2017 15:38:30 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/In-IML-is-it-possible-to-pass-a-function-name-as-argument-to/m-p/406593#M3793</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-10-23T15:38:30Z</dc:date>
    </item>
    <item>
      <title>Re: In IML, is it possible to pass a function name as argument to other functions?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/In-IML-is-it-possible-to-pass-a-function-name-as-argument-to/m-p/406595#M3794</link>
      <description>&lt;P&gt;I guess the general answer is that you can build the function call as a text string and then use CALL EXECUTE to call the function:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;start calc(x,y,func);
   z = .;
   cmd = "z = " + func + "(x,y);";
   call execute( cmd );
   return z;
finish;

x=2; y=3;
a = calc(x,y,"try1"); print a;
b = calc(x,y,"try2"); print b;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 23 Oct 2017 15:43:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/In-IML-is-it-possible-to-pass-a-function-name-as-argument-to/m-p/406595#M3794</guid>
      <dc:creator>Rick_SAS</dc:creator>
      <dc:date>2017-10-23T15:43:55Z</dc:date>
    </item>
    <item>
      <title>Re: In IML, is it possible to pass a function name as argument to other functions?</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/In-IML-is-it-possible-to-pass-a-function-name-as-argument-to/m-p/406614#M3795</link>
      <description>&lt;P&gt;Yes, I see.&amp;nbsp; I did not know of either of these two strategies.&amp;nbsp; Perfectly clear answer with your examples.&amp;nbsp; Thanks very much for the information.&amp;nbsp; A great help.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Oct 2017 16:15:21 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/In-IML-is-it-possible-to-pass-a-function-name-as-argument-to/m-p/406614#M3795</guid>
      <dc:creator>_bc_</dc:creator>
      <dc:date>2017-10-23T16:15:21Z</dc:date>
    </item>
  </channel>
</rss>

