<?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: Invalid macro name in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/Invalid-macro-name/m-p/773080#M245529</link>
    <description>The log as text would be more helpful. &lt;BR /&gt;Please don't post it as images.</description>
    <pubDate>Fri, 08 Oct 2021 16:27:39 GMT</pubDate>
    <dc:creator>Reeza</dc:creator>
    <dc:date>2021-10-08T16:27:39Z</dc:date>
    <item>
      <title>Invalid macro name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-macro-name/m-p/773071#M245521</link>
      <description>&lt;P&gt;Dear community,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't understand why I have this error message when I want to run my macro.&lt;/P&gt;&lt;P&gt;Could you help me please ?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Capture d’écran 2021-10-08 à 18.08.59.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64522i244C962965B0747C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture d’écran 2021-10-08 à 18.08.59.png" alt="Capture d’écran 2021-10-08 à 18.08.59.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Capture d’écran 2021-10-08 à 18.07.14.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64523iEAA00D4D3682CB88/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture d’écran 2021-10-08 à 18.07.14.png" alt="Capture d’écran 2021-10-08 à 18.07.14.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 16:10:01 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-macro-name/m-p/773071#M245521</guid>
      <dc:creator>Rodrigue</dc:creator>
      <dc:date>2021-10-08T16:10:01Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid macro name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-macro-name/m-p/773073#M245523</link>
      <description>&lt;P&gt;That's line 706 - I think the actual issue is before that line making it invalid - a missing semicolon or something perhaps???&lt;/P&gt;
&lt;P&gt;Try creating the macro in a separate program/session and see if that still generates an error.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Made a small example that shows your macro name/calling isn't the issue:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt; 1          OPTIONS NONOTES NOSTIMER NOSOURCE NOSYNTAXCHECK;
 68         
 69         %macro com (com, year);
 70         
 71         %put &amp;amp;com.;
 72         %put &amp;amp;year.;
 73         
 74         %mend;
 75         
 76         %com(25, 2014);
 25
 2014&lt;/CODE&gt;&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/386767"&gt;@Rodrigue&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Dear community,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I don't understand why I have this error message when I want to run my macro.&lt;/P&gt;
&lt;P&gt;Could you help me please ?&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Capture d’écran 2021-10-08 à 18.08.59.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64522i244C962965B0747C/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture d’écran 2021-10-08 à 18.08.59.png" alt="Capture d’écran 2021-10-08 à 18.08.59.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-center" image-alt="Capture d’écran 2021-10-08 à 18.07.14.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64523iEAA00D4D3682CB88/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture d’écran 2021-10-08 à 18.07.14.png" alt="Capture d’écran 2021-10-08 à 18.07.14.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 16:18:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-macro-name/m-p/773073#M245523</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-10-08T16:18:57Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid macro name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-macro-name/m-p/773074#M245524</link>
      <description>&lt;P&gt;Perhaps there is an error earlier in your code (like a missing semi-colon or something similar). Show us more of the log before you get to &lt;FONT face="courier new,courier"&gt;%macro com&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 16:19:23 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-macro-name/m-p/773074#M245524</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-10-08T16:19:23Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid macro name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-macro-name/m-p/773076#M245525</link>
      <description>&lt;P&gt;What&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/13879"&gt;@Reeza&lt;/a&gt;&amp;nbsp;&amp;amp;&amp;nbsp;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/10892"&gt;@PaigeMiller&lt;/a&gt;&amp;nbsp;said, everything looks like it should work. This leads me to think something earlier in your SAS session is causing the issue and SAS is only figuring that out at this point.&lt;BR /&gt;&lt;BR /&gt;I'd start by restarting your SAS session, and try running only this macro&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 16:21:59 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-macro-name/m-p/773076#M245525</guid>
      <dc:creator>AMSAS</dc:creator>
      <dc:date>2021-10-08T16:21:59Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid macro name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-macro-name/m-p/773079#M245526</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture d’écran 2021-10-08 à 18.22.08.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64524iAB9B2B0982AFC810/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture d’écran 2021-10-08 à 18.22.08.png" alt="Capture d’écran 2021-10-08 à 18.22.08.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Capture d’écran 2021-10-08 à 18.23.10.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/64525i72523C58ED523ED6/image-size/large?v=v2&amp;amp;px=999" role="button" title="Capture d’écran 2021-10-08 à 18.23.10.png" alt="Capture d’écran 2021-10-08 à 18.23.10.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 16:25:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-macro-name/m-p/773079#M245526</guid>
      <dc:creator>Rodrigue</dc:creator>
      <dc:date>2021-10-08T16:25:10Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid macro name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-macro-name/m-p/773080#M245529</link>
      <description>The log as text would be more helpful. &lt;BR /&gt;Please don't post it as images.</description>
      <pubDate>Fri, 08 Oct 2021 16:27:39 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-macro-name/m-p/773080#M245529</guid>
      <dc:creator>Reeza</dc:creator>
      <dc:date>2021-10-08T16:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid macro name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-macro-name/m-p/773081#M245530</link>
      <description>&lt;P&gt;Delete that invisible character between the M and (.&amp;nbsp; You might also want to replace the space between macro and com.&lt;/P&gt;
&lt;P&gt;To recreate the issue create a macro definition like this:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%macro comX(a,b);
%put &amp;amp;=a &amp;amp;=b ;
%mend ;
%comX(one,two);&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Then use change command to change the X into an invisible character, like the hex code 'A0'x that some systems use as meaning non-breaking space.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;change X 'A0'x all&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;And submit that code:&lt;/P&gt;
&lt;PRE&gt;50    %macro com&amp;nbsp;(a,b);
ERROR: The SAS Macro Facility is unable to write the macro 'COM&amp;nbsp;'n to the macro library.
ERROR: The value COM&amp;nbsp; is not a valid SAS name.
51    %put &amp;amp;=a &amp;amp;=b ;
52    %mend ;
53    %com&amp;nbsp;(one,two);
      -
      180
ERROR: The value COM&amp;nbsp; is not a valid SAS name.
WARNING: Apparent invocation of macro COM&amp;nbsp; not resolved.

ERROR 180-322: Statement is not valid or it is used out of proper order.
&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 16:29:27 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-macro-name/m-p/773081#M245530</guid>
      <dc:creator>Tom</dc:creator>
      <dc:date>2021-10-08T16:29:27Z</dc:date>
    </item>
    <item>
      <title>Re: Invalid macro name</title>
      <link>https://communities.sas.com/t5/SAS-Programming/Invalid-macro-name/m-p/773083#M245531</link>
      <description>&lt;P&gt;If &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/159"&gt;@Tom&lt;/a&gt; is right about invisible characters, that's a great catch.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;And, &lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/386767"&gt;@Rodrigue&lt;/a&gt; , this is why we always ask for you to provide the log as text (pasted into the window that appears when you click on the &amp;lt;/&amp;gt; icon) and not a screen capture. In the future, we shall expect the log as text, not a screen capture.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Oct 2021 16:30:34 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/Invalid-macro-name/m-p/773083#M245531</guid>
      <dc:creator>PaigeMiller</dc:creator>
      <dc:date>2021-10-08T16:30:34Z</dc:date>
    </item>
  </channel>
</rss>

