Why does a part of variable name in DATA step come RED when we use a macro variable in the other part?
Example -
VAR_¯o_var. = VAR1/VAR2;
Because the editor is just using some text scanning rules someone created to highlight code. So according to its rules that word VAR should be displayed in red.
It is NOT actually pre-compiling the code to figure out how each character/word in the program is actually going to be used. That will be done by SAS (not the editor) when the code is run.
The highlighting in the editor is just a attempt to assist you in understanding the code. The colors do not have any actual impact on whether or how the code works.
But the code works fine. The variable is created and there are no error or warning.
You are not alone. There has been a discussion (https://communities.sas.com/t5/SAS-Procedures/Red-color-for-unrecognized-statements-Help-improve-col...).
I guess, then, that this is the editor issue/settings. When actually the macro is resolved it runs fine.
Based on the discussion above, I guess that the editor/IDE is red flagging but not the compiler.
Because the editor is just using some text scanning rules someone created to highlight code. So according to its rules that word VAR should be displayed in red.
It is NOT actually pre-compiling the code to figure out how each character/word in the program is actually going to be used. That will be done by SAS (not the editor) when the code is run.
The highlighting in the editor is just a attempt to assist you in understanding the code. The colors do not have any actual impact on whether or how the code works.
SAS Innovate 2025 is scheduled for May 6-9 in Orlando, FL. Sign up to be first to learn about the agenda and registration!
SAS' Charu Shankar shares her PROC SQL expertise by showing you how to master the WHERE clause using real winter weather data.
Find more tutorials on the SAS Users YouTube channel.