<?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: Function-style macros vs proc fcmp functions in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Function-style-macros-vs-proc-fcmp-functions/m-p/244017#M45435</link>
    <description>Not sure about readability. Macros has been around forever, and FCMP is a fairly new concept. &lt;BR /&gt;But I would suspect that FCMP functions often is more efficient than their macro counterpart.</description>
    <pubDate>Sat, 16 Jan 2016 21:33:19 GMT</pubDate>
    <dc:creator>LinusH</dc:creator>
    <dc:date>2016-01-16T21:33:19Z</dc:date>
    <item>
      <title>Function-style macros vs proc fcmp functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Function-style-macros-vs-proc-fcmp-functions/m-p/244008#M45429</link>
      <description>&lt;P&gt;Someone posted this quesiton on StackOverflow&amp;nbsp;&lt;A href="https://stackoverflow.com/questions/34820068/function-style-macros-vs-proc-fcmp-functions" target="_blank"&gt;https://stackoverflow.com/questions/34820068/function-style-macros-vs-proc-fcmp-functions&lt;/A&gt; &amp;nbsp;but it is probably better suited for discusion here.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;I am considering replacing a lot of function-style macros with FCMP equivalents. Before I go through this process I was wondering what limitations FCMP has compared to function style macros? Has anyone else been through this process and are there any reasons why I would &lt;EM&gt;not&lt;/EM&gt;want to do this?&lt;/P&gt;
&lt;P&gt;My reasons for wanting to do this is to make code easier to read and maintain, and less error-prone. I believe that FCMP functions are easier to read than macro code for most SAS programmers.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;What do people think?&lt;/P&gt;</description>
      <pubDate>Sat, 16 Jan 2016 17:40:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Function-style-macros-vs-proc-fcmp-functions/m-p/244008#M45429</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-01-16T17:40:18Z</dc:date>
    </item>
    <item>
      <title>Re: Function-style macros vs proc fcmp functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Function-style-macros-vs-proc-fcmp-functions/m-p/244014#M45433</link>
      <description>&lt;P&gt;I am not that familiar with functions build with PROC FCMP, but a SAS macro has one of the most user friendly calling interfaces I have seen. &amp;nbsp;You do not need to use positional parameters and instead can use names in the macro call. &amp;nbsp;You can even use the names in the macro call when the macro was defined to support positional parameters. &amp;nbsp;I would hate to give that up.&lt;/P&gt;</description>
      <pubDate>Sat, 16 Jan 2016 20:13:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Function-style-macros-vs-proc-fcmp-functions/m-p/244014#M45433</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2016-01-16T20:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: Function-style macros vs proc fcmp functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Function-style-macros-vs-proc-fcmp-functions/m-p/244017#M45435</link>
      <description>Not sure about readability. Macros has been around forever, and FCMP is a fairly new concept. &lt;BR /&gt;But I would suspect that FCMP functions often is more efficient than their macro counterpart.</description>
      <pubDate>Sat, 16 Jan 2016 21:33:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Function-style-macros-vs-proc-fcmp-functions/m-p/244017#M45435</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-01-16T21:33:19Z</dc:date>
    </item>
    <item>
      <title>Re: Function-style macros vs proc fcmp functions</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Function-style-macros-vs-proc-fcmp-functions/m-p/244022#M45437</link>
      <description>&lt;P&gt;I promised myself to use FCMP more in the future, but&amp;nbsp;you should beware it is not just another way to write the same thing (it is not sytactic sugar).&amp;nbsp;&lt;/P&gt;&lt;P&gt;Function-like&amp;nbsp;macros are interpreted before compilation. If you write them inside a data step, the same code is compiled, no&amp;nbsp;mather how many observations you will process.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you call FCMP functions, a call is made for each observation.I expect this to be a serious performance penalty in benchmarks, especially if I see how loosly coupled the logic in and outside the FCMP are.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The positive sides I see are:&lt;/P&gt;&lt;P&gt;1. function like macro's can have&amp;nbsp;unexpected side effects. FCMP functions don't (as far as I understand)&lt;/P&gt;&lt;P&gt;2. FCMP functions can run complete procedures or datasteps by calling a macro for each observation of a dataset. See also also&amp;nbsp;&lt;A href="http://stackoverflow.com/questions/33817518/sas-how-to-return-a-value-from-a-sas-macro/33830485#33830485.&amp;nbsp;" target="_blank"&gt;http://stackoverflow.com/questions/33817518/sas-how-to-return-a-value-from-a-sas-macro/33830485#33830485.&amp;nbsp;&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 16 Jan 2016 22:13:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Function-style-macros-vs-proc-fcmp-functions/m-p/244022#M45437</guid>
      <dc:creator>DirkH</dc:creator>
      <dc:date>2016-01-16T22:13:28Z</dc:date>
    </item>
  </channel>
</rss>

