<?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 %COPY Statement, Error: &amp;quot;Macro keyword END appears as text. in SAS Programming</title>
    <link>https://communities.sas.com/t5/SAS-Programming/COPY-Statement-Error-quot-Macro-keyword-END-appears-as-text/m-p/470224#M120362</link>
    <description>&lt;P&gt;Hi Folks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to write a Macro, which writes (depending on the macro parameters) the source code of a compiled macro (from a macro catalog) into the log or a *sas file, respectively.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I always get an error message, when compiling the macro, which says:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"ERROR: Macro keyword END appears as text."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem ist obviously, that my %IF .... %THEN %DO .....&amp;nbsp; %END&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %ELSE %DO..... %END;&lt;/P&gt;&lt;P&gt;case differentiation cannot be used with the %COPY Statement as it is already a macro by itself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my question is: how can I somehow get a workaround or mask the above mentioned macro key words?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO get_macro_sourcecode(_makroname= , _librefMacKatalog= , _outPfad=) /store source DES="Makro, um den Sourcecode eines kompilierten Makros ins Log ODER in eine ' *.sas ' Datei auszugeben.";

/*Fall 1: Codeausgabe in *sas-Datei und libref UNGLEICH der libref in Systemoption "sasmstore" */
%IF  %sysevalf(%superq(_outPfad)= ,boolean) eq 0 AND  %sysevalf(%superq(_librefMacKatalog)= ,boolean) eq 0  %THEN %DO;
	%COPY %UPCASE(&amp;amp;_makroname.) /SOURCE  LIBRARY=&amp;amp;_librefMacKatalog.  out="&amp;amp;_outPfad.&amp;amp;_makroname..sas" 
%END;

/*Fall 2: Codeausgabe in *sas-Datei und libref GLEICH der libref in Systemoption "sasmstore" */
%IF  %sysevalf(%superq(_outPfad)= ,boolean) eq 0 AND  %sysevalf(%superq(_librefMacKatalog)= ,boolean) eq 1 %THEN %DO;
	%COPY %UPCASE(&amp;amp;_makroname.) /SOURCE  out="&amp;amp;_outPfad.&amp;amp;_makroname..sas" 
%END;

/*Fall 3: Keine Ausgabe in ".sas" - Datei, sondern Ausgabe ins Log und libref UNGLEICH der libref in Systemoption "sasmstore" */
%IF %sysevalf(%superq(_outPfad)= ,boolean) eq 1 AND %sysevalf(%superq(_librefMacKatalog)= ,boolean) eq 0  %THEN %DO;
	%COPY %UPCASE(&amp;amp;_makroname.) /SOURCE LIBRARY=&amp;amp;_librefMacKatalog. ;
%END;

/*Fall 4: Keine Ausgabe in ".sas" - Datei, sondern Ausgabe ins Log und libref GLEICH der libref in Systemoption "sasmstore" */
%IF %sysevalf(%superq(_outPfad)= ,boolean) eq 1 AND %sysevalf(%superq(_librefMacKatalog)= ,boolean) eq 1  %THEN %DO;
	%COPY %UPCASE(&amp;amp;_makroname.) /SOURCE LIBRARY=&amp;amp;_librefMacKatalog. ;
%END;

%MEND;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 14 Jun 2018 09:14:00 GMT</pubDate>
    <dc:creator>FK1</dc:creator>
    <dc:date>2018-06-14T09:14:00Z</dc:date>
    <item>
      <title>%COPY Statement, Error: "Macro keyword END appears as text.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/COPY-Statement-Error-quot-Macro-keyword-END-appears-as-text/m-p/470224#M120362</link>
      <description>&lt;P&gt;Hi Folks,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to write a Macro, which writes (depending on the macro parameters) the source code of a compiled macro (from a macro catalog) into the log or a *sas file, respectively.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, I always get an error message, when compiling the macro, which says:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"ERROR: Macro keyword END appears as text."&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The problem ist obviously, that my %IF .... %THEN %DO .....&amp;nbsp; %END&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; %ELSE %DO..... %END;&lt;/P&gt;&lt;P&gt;case differentiation cannot be used with the %COPY Statement as it is already a macro by itself.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;So my question is: how can I somehow get a workaround or mask the above mentioned macro key words?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is my code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;%MACRO get_macro_sourcecode(_makroname= , _librefMacKatalog= , _outPfad=) /store source DES="Makro, um den Sourcecode eines kompilierten Makros ins Log ODER in eine ' *.sas ' Datei auszugeben.";

/*Fall 1: Codeausgabe in *sas-Datei und libref UNGLEICH der libref in Systemoption "sasmstore" */
%IF  %sysevalf(%superq(_outPfad)= ,boolean) eq 0 AND  %sysevalf(%superq(_librefMacKatalog)= ,boolean) eq 0  %THEN %DO;
	%COPY %UPCASE(&amp;amp;_makroname.) /SOURCE  LIBRARY=&amp;amp;_librefMacKatalog.  out="&amp;amp;_outPfad.&amp;amp;_makroname..sas" 
%END;

/*Fall 2: Codeausgabe in *sas-Datei und libref GLEICH der libref in Systemoption "sasmstore" */
%IF  %sysevalf(%superq(_outPfad)= ,boolean) eq 0 AND  %sysevalf(%superq(_librefMacKatalog)= ,boolean) eq 1 %THEN %DO;
	%COPY %UPCASE(&amp;amp;_makroname.) /SOURCE  out="&amp;amp;_outPfad.&amp;amp;_makroname..sas" 
%END;

/*Fall 3: Keine Ausgabe in ".sas" - Datei, sondern Ausgabe ins Log und libref UNGLEICH der libref in Systemoption "sasmstore" */
%IF %sysevalf(%superq(_outPfad)= ,boolean) eq 1 AND %sysevalf(%superq(_librefMacKatalog)= ,boolean) eq 0  %THEN %DO;
	%COPY %UPCASE(&amp;amp;_makroname.) /SOURCE LIBRARY=&amp;amp;_librefMacKatalog. ;
%END;

/*Fall 4: Keine Ausgabe in ".sas" - Datei, sondern Ausgabe ins Log und libref GLEICH der libref in Systemoption "sasmstore" */
%IF %sysevalf(%superq(_outPfad)= ,boolean) eq 1 AND %sysevalf(%superq(_librefMacKatalog)= ,boolean) eq 1  %THEN %DO;
	%COPY %UPCASE(&amp;amp;_makroname.) /SOURCE LIBRARY=&amp;amp;_librefMacKatalog. ;
%END;

%MEND;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 09:14:00 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/COPY-Statement-Error-quot-Macro-keyword-END-appears-as-text/m-p/470224#M120362</guid>
      <dc:creator>FK1</dc:creator>
      <dc:date>2018-06-14T09:14:00Z</dc:date>
    </item>
    <item>
      <title>Re: %COPY Statement, Error: "Macro keyword END appears as text.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/COPY-Statement-Error-quot-Macro-keyword-END-appears-as-text/m-p/470227#M120365</link>
      <description>&lt;P&gt;I am sorry, I just simply missed to put ";" behind some of the statements....&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 09:37:10 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/COPY-Statement-Error-quot-Macro-keyword-END-appears-as-text/m-p/470227#M120365</guid>
      <dc:creator>FK1</dc:creator>
      <dc:date>2018-06-14T09:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: %COPY Statement, Error: "Macro keyword END appears as text.</title>
      <link>https://communities.sas.com/t5/SAS-Programming/COPY-Statement-Error-quot-Macro-keyword-END-appears-as-text/m-p/470228#M120366</link>
      <description>&lt;P&gt;Post the log, with options mlogic mprint symbolgen turned on.&amp;nbsp; Also, please avoid coding in SHOUTING case, it really makes code hard to read.&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jun 2018 09:42:22 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-Programming/COPY-Statement-Error-quot-Macro-keyword-END-appears-as-text/m-p/470228#M120366</guid>
      <dc:creator>RW9</dc:creator>
      <dc:date>2018-06-14T09:42:22Z</dc:date>
    </item>
  </channel>
</rss>

