<?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: &amp;amp;macro statement in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/amp-macro-statement/m-p/390735#M93770</link>
    <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/101819"&gt;@CurtisSmithDCAA&lt;/a&gt;: I disagree! If you need to create a macro whose name includes a macro variable you could always simply create it as an include file. e.g.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let app=hello;
filename testit '/folders/myfolders/testit.sas';
data _null_;
  length forinc $80;
  file testit;
  forinc=catt('%macro analyze_byvar_',"&amp;amp;app",';');
  put forinc;
  put 'x=1;';
  forinc=catt('%mend analyze_byvar_',"&amp;amp;app",';');
  put forinc;
run;

%include testit;
data test;
  input y;
  %analyze_byvar_hello;
  cards;
1
2
3
;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 24 Aug 2017 19:34:34 GMT</pubDate>
    <dc:creator>art297</dc:creator>
    <dc:date>2017-08-24T19:34:34Z</dc:date>
    <item>
      <title>&amp;macro statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/amp-macro-statement/m-p/390674#M93741</link>
      <description>&lt;P&gt;Hi. I'm trying to use a macro variable in the name of a %macro statement. For example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;%let app=hello;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000080" face="Courier New" size="2"&gt;&lt;STRONG&gt;%macro&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt; &lt;STRONG&gt;&lt;I&gt;analyze_byvar_&lt;/I&gt;&lt;/STRONG&gt;&amp;amp;&amp;amp;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;app.&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;%mend &lt;FONT size="2"&gt;&lt;FONT face="Courier New"&gt;&lt;STRONG&gt;&lt;EM&gt;analyze_byvar_&lt;/EM&gt;&lt;/STRONG&gt;&amp;amp;&amp;amp;&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#008080" face="Courier New" size="2"&gt;app.&lt;/FONT&gt;;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;However, when I invoke the macro the name does not resolve. &lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Any suggestions?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 16:14:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/amp-macro-statement/m-p/390674#M93741</guid>
      <dc:creator>CurtisSmithDCAA</dc:creator>
      <dc:date>2017-08-24T16:14:09Z</dc:date>
    </item>
    <item>
      <title>Re: &amp;macro statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/amp-macro-statement/m-p/390678#M93742</link>
      <description>&lt;P&gt;&lt;SPAN&gt;names the macro. A macro name must be a SAS name, which you supply;&lt;STRONG&gt; you cannot use a text expression to generate a macro name&lt;/STRONG&gt; in a %MACRO statement. In addition, do not use macro reserved words as a macro name.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 16:18:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/amp-macro-statement/m-p/390678#M93742</guid>
      <dc:creator>novinosrin</dc:creator>
      <dc:date>2017-08-24T16:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: &amp;macro statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/amp-macro-statement/m-p/390690#M93743</link>
      <description>&lt;P&gt;The reference to a macro variable works when invoking a macro.&amp;nbsp; This should be fine:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;%analyze_byvar_&amp;amp;app.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;However, it doesn't work when naming a macro.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 16:42:31 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/amp-macro-statement/m-p/390690#M93743</guid>
      <dc:creator>Astounding</dc:creator>
      <dc:date>2017-08-24T16:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: &amp;macro statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/amp-macro-statement/m-p/390693#M93746</link>
      <description>&lt;P&gt;In almost any approach that I can imagine whatever you may be attempting it would likely be much better to have a single macro and have the value you are calling APP as a parameter to the macro. Since you do not show any parameters I suspect you need to delve a little further into macro language documentation.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you had shown what that macro is supposed to actually do we might make more constructive comments.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Show us log where you compiled the macro. I suspect that it did not compile.&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 16:47:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/amp-macro-statement/m-p/390693#M93746</guid>
      <dc:creator>ballardw</dc:creator>
      <dc:date>2017-08-24T16:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: &amp;macro statement</title>
      <link>https://communities.sas.com/t5/SAS-Programming/amp-macro-statement/m-p/390735#M93770</link>
      <description>&lt;P&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/101819"&gt;@CurtisSmithDCAA&lt;/a&gt;: I disagree! If you need to create a macro whose name includes a macro variable you could always simply create it as an include file. e.g.:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;%let app=hello;
filename testit '/folders/myfolders/testit.sas';
data _null_;
  length forinc $80;
  file testit;
  forinc=catt('%macro analyze_byvar_',"&amp;amp;app",';');
  put forinc;
  put 'x=1;';
  forinc=catt('%mend analyze_byvar_',"&amp;amp;app",';');
  put forinc;
run;

%include testit;
data test;
  input y;
  %analyze_byvar_hello;
  cards;
1
2
3
;
&lt;/PRE&gt;
&lt;P&gt;Art, CEO, AnalystFinder.com&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 24 Aug 2017 19:34:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/amp-macro-statement/m-p/390735#M93770</guid>
      <dc:creator>art297</dc:creator>
      <dc:date>2017-08-24T19:34:34Z</dc:date>
    </item>
  </channel>
</rss>

