Hi Folks, 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. However, I always get an error message, when compiling the macro, which says: "ERROR: Macro keyword END appears as text." The problem ist obviously, that my %IF .... %THEN %DO ..... %END %ELSE %DO..... %END; case differentiation cannot be used with the %COPY Statement as it is already a macro by itself. So my question is: how can I somehow get a workaround or mask the above mentioned macro key words? Here is my code: %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(&_makroname.) /SOURCE LIBRARY=&_librefMacKatalog. out="&_outPfad.&_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(&_makroname.) /SOURCE out="&_outPfad.&_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(&_makroname.) /SOURCE LIBRARY=&_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(&_makroname.) /SOURCE LIBRARY=&_librefMacKatalog. ;
%END;
%MEND;
... View more