<?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: MACROS in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/MACROS/m-p/280124#M56559</link>
    <description>&lt;P&gt;Yes you can.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the same session you can do stuff like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro outer;
   %put In outer;
    %inner
%mend

%macro inner;
    %put In inner
%mend;

%outer;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The inner macro needs to be defined at call time, not nescecarily when %Outer is defined. And %inner can be redefined without the need for %outer to be recompiled.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Existing macros can also be defined earlier or outside SAS. Store them in a file with the .sas extension and have the SASAUTOS option point to its location.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza﻿&lt;/a&gt; pointed out, macro's do not technically return a value like a function does. But it is conceptually close enough. Just look at the %SYSRC autocall macro for a nice example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;- Jan.&lt;/P&gt;</description>
    <pubDate>Sat, 25 Jun 2016 08:46:55 GMT</pubDate>
    <dc:creator>jklaverstijn</dc:creator>
    <dc:date>2016-06-25T08:46:55Z</dc:date>
    <item>
      <title>MACROS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MACROS/m-p/280100#M56548</link>
      <description>&lt;P&gt;is there a way to call an already created macro function and use it in another macro function that I am trying to create?&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jun 2016 23:38:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MACROS/m-p/280100#M56548</guid>
      <dc:creator>ejohnson96</dc:creator>
      <dc:date>2016-06-24T23:38:12Z</dc:date>
    </item>
    <item>
      <title>Re: MACROS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MACROS/m-p/280102#M56550</link>
      <description>&lt;P&gt;For functions you want Proc FCMP.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Macros don't return values.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You can call a macro within any other macro once it's been compiled.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%macro_name(parameters);&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If your replicating R code you can consider SAS/IML instead of Base.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Otherwise you may want to define your functionality and figure out the best method in SAS. Trying to replicate exactly is more work in long run. My nickel.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 25 Jun 2016 00:06:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MACROS/m-p/280102#M56550</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2016-06-25T00:06:10Z</dc:date>
    </item>
    <item>
      <title>Re: MACROS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MACROS/m-p/280118#M56556</link>
      <description>Technically macros generate text  (preferably SAS code).&lt;BR /&gt;But, you could design a macro so it behaves like a function, like returning a value in an assignment statement. &lt;BR /&gt;Depending on the nature of your macro, PROC FCMP might be a better choice as &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt; suggest. &lt;BR /&gt;Bottom line, yes you can call a macro from another macro.&lt;BR /&gt;What does your "macro functions" do?</description>
      <pubDate>Sat, 25 Jun 2016 06:52:12 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MACROS/m-p/280118#M56556</guid>
      <dc:creator>LinusH</dc:creator>
      <dc:date>2016-06-25T06:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: MACROS</title>
      <link>https://communities.sas.com/t5/SAS-Programming/MACROS/m-p/280124#M56559</link>
      <description>&lt;P&gt;Yes you can.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In the same session you can do stuff like this:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro outer;
   %put In outer;
    %inner
%mend

%macro inner;
    %put In inner
%mend;

%outer;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;The inner macro needs to be defined at call time, not nescecarily when %Outer is defined. And %inner can be redefined without the need for %outer to be recompiled.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Existing macros can also be defined earlier or outside SAS. Store them in a file with the .sas extension and have the SASAUTOS option point to its location.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;As &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza﻿&lt;/a&gt; pointed out, macro's do not technically return a value like a function does. But it is conceptually close enough. Just look at the %SYSRC autocall macro for a nice example.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hope this helps,&lt;/P&gt;
&lt;P&gt;- Jan.&lt;/P&gt;</description>
      <pubDate>Sat, 25 Jun 2016 08:46:55 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/MACROS/m-p/280124#M56559</guid>
      <dc:creator>jklaverstijn</dc:creator>
      <dc:date>2016-06-25T08:46:55Z</dc:date>
    </item>
  </channel>
</rss>

