<?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 How to form the macro application with macro variable in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/How-to-form-the-macro-application-with-macro-variable/m-p/607207#M176442</link>
    <description>%let sex=F;&lt;BR /&gt;%macro &amp;amp;sex;&lt;BR /&gt;Proc print data=sashelp.class;&lt;BR /&gt;Run;&lt;BR /&gt;%mend;&lt;BR /&gt;&lt;BR /&gt;%&amp;amp;sex;&lt;BR /&gt;&lt;BR /&gt;I wrote one application but i am getting error .&lt;BR /&gt;Please help to fix this</description>
    <pubDate>Tue, 26 Nov 2019 05:51:13 GMT</pubDate>
    <dc:creator>thanikondharish</dc:creator>
    <dc:date>2019-11-26T05:51:13Z</dc:date>
    <item>
      <title>How to form the macro application with macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-form-the-macro-application-with-macro-variable/m-p/607207#M176442</link>
      <description>%let sex=F;&lt;BR /&gt;%macro &amp;amp;sex;&lt;BR /&gt;Proc print data=sashelp.class;&lt;BR /&gt;Run;&lt;BR /&gt;%mend;&lt;BR /&gt;&lt;BR /&gt;%&amp;amp;sex;&lt;BR /&gt;&lt;BR /&gt;I wrote one application but i am getting error .&lt;BR /&gt;Please help to fix this</description>
      <pubDate>Tue, 26 Nov 2019 05:51:13 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-form-the-macro-application-with-macro-variable/m-p/607207#M176442</guid>
      <dc:creator>thanikondharish</dc:creator>
      <dc:date>2019-11-26T05:51:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to form the macro application with macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-form-the-macro-application-with-macro-variable/m-p/607209#M176443</link>
      <description>&lt;P&gt;As the &lt;A href="https://documentation.sas.com/?docsetId=mcrolref&amp;amp;docsetTarget=p1nypovnwon4uyn159rst8pgzqrl.htm&amp;amp;docsetVersion=9.4&amp;amp;locale=en" target="_self"&gt;%Macro Statement Documentation&lt;/A&gt; says: &lt;EM&gt;"&lt;/EM&gt;&lt;SPAN&gt;&lt;EM&gt;A macro name must be a SAS name, which you supply; you cannot use a text expression to generate a macro name in a %MACRO statement"&lt;/EM&gt;.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Which means that you can not use a macro variable in a %Macro Statement.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 05:56:36 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-form-the-macro-application-with-macro-variable/m-p/607209#M176443</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-26T05:56:36Z</dc:date>
    </item>
    <item>
      <title>Re: How to form the macro application with macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-form-the-macro-application-with-macro-variable/m-p/607210#M176444</link>
      <description>Thaks,&lt;BR /&gt;Is there any other option?</description>
      <pubDate>Tue, 26 Nov 2019 06:02:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-form-the-macro-application-with-macro-variable/m-p/607210#M176444</guid>
      <dc:creator>thanikondharish</dc:creator>
      <dc:date>2019-11-26T06:02:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to form the macro application with macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-form-the-macro-application-with-macro-variable/m-p/607211#M176445</link>
      <description>&lt;P&gt;Why do you want to create macros with dynamic names? It makes your code hard. Here is one way:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%let sex=F;
options mprint;

data _null_;
  macro_name = "&amp;amp;sex";
  call execute('%nrstr(%macro '!!macro_name!!';)');
  call execute('%nrstr(proc print data = sashelp.class;run;)');
  call execute('%nrstr(%mend '!!macro_name!!';)');
  call execute('%nrstr(%'!!macro_name!!';)');
run;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;You could also write the same statements to an external text file then %INCLUDE them.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 06:35:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-form-the-macro-application-with-macro-variable/m-p/607211#M176445</guid>
      <dc:creator>SASKiwi</dc:creator>
      <dc:date>2019-11-26T06:35:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to form the macro application with macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-form-the-macro-application-with-macro-variable/m-p/607213#M176447</link>
      <description>&lt;P&gt;First of all, why do you want to create a macro with a dynamic name? The dynamic part of a macro should be its arguments.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 06:33:28 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-form-the-macro-application-with-macro-variable/m-p/607213#M176447</guid>
      <dc:creator>PeterClemmensen</dc:creator>
      <dc:date>2019-11-26T06:33:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to form the macro application with macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-form-the-macro-application-with-macro-variable/m-p/607227#M176454</link>
      <description>&lt;P&gt;Even if you could, you don't. It creates unmaintainable code.&lt;/P&gt;
&lt;P&gt;DO NOT DO IT. DO NOT EVEN THINK ABOUT IT.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What for do you even think this is needed?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 08:12:51 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-form-the-macro-application-with-macro-variable/m-p/607227#M176454</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-26T08:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to form the macro application with macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-form-the-macro-application-with-macro-variable/m-p/607230#M176456</link>
      <description>I want to create 3 macro applici at a time&lt;BR /&gt;1-F&lt;BR /&gt;2-M&lt;BR /&gt;3-O</description>
      <pubDate>Tue, 26 Nov 2019 08:37:18 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-form-the-macro-application-with-macro-variable/m-p/607230#M176456</guid>
      <dc:creator>thanikondharish</dc:creator>
      <dc:date>2019-11-26T08:37:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to form the macro application with macro variable</title>
      <link>https://communities.sas.com/t5/SAS-Programming/How-to-form-the-macro-application-with-macro-variable/m-p/607237#M176459</link>
      <description>&lt;P&gt;And what is the difference between those macros? You're much better off creating one macro that expects one of F,M,O as a parameter and acts accordingly.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Nov 2019 09:08:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/How-to-form-the-macro-application-with-macro-variable/m-p/607237#M176459</guid>
      <dc:creator>Kurt_Bremser</dc:creator>
      <dc:date>2019-11-26T09:08:59Z</dc:date>
    </item>
  </channel>
</rss>

