I tried to comment out a macro by placing /* before the %macro and */ after the %mend; But for some reason that did not work:
I actually had to place another /* before the PROC SQL statement:
Any suggestions as to why this is the case? I had originally made my change in a text editor, not SAS EG 8. So, the process threw errors when I ran the code.
Did SAS actually re-define the macro in in the first case when you ran the code?
Or are you just talking about the colors you see in the pictures you posted? That is are just just asking about the algorithm that the editor you are using uses to color the text on the screen?
But for some reason that did not work:
What do you mean? What doesn't work? Please be specific and detailed. Is the macro still available and used by the program when you expect it should not longer be available? Or do you mean something else?
If a macro is defined and available to the program because you have executed the macro code earlier in the program, then commenting out the macro does not change the fact that the macro is still available to the program.
If you start a comment with /* you should end it with */ to make a "block comment".
If you do not use the */ then it appears in your case the comment used the * <text until the first>; line comment.
And your second /* compounds the not correct usage.
Either use /* */ or know that * ; defines start / end of comment. Inside a macro definition you want to use /* */ or %* ; to comment as the macro language processor may treat *; style comments as valid code submitted to code processor.
Note that nesting /* /* type comment starts can lead to unstable code as the IDE is not set up to handle figuring how to "unnest" or end the comments properly.
/* */ will definitely comment out a macro definition, macro call, or anything else (except a nested /* */ ).
It doesn't matter if you write the code in a text editor or in EG.
The coloring shown in EG is sometimes wrong, because EG has simple rules for trying to guess if code is a comment or not. But the coloring of the code does not have any impact on how the code executes. EG is just trying to be helpful to the person looking at EG screen. When the code is sent to SAS to execute, coloring of the code is not sent to SAS.
If you are getting errors, they are likely coming from some other part of your code you haven't shown.
Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.
Register today!Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.