BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.

Why does a part of variable name in DATA step come RED when we use a macro variable in the other part?

Example -

VAR_&macro_var. = VAR1/VAR2;

1 ACCEPTED SOLUTION

Accepted Solutions
Tom
Super User Tom
Super User

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.

View solution in original post

7 REPLIES 7
koyelghosh
Lapis Lazuli | Level 10
May be an indication of an unrecognized statement.
thepushkarsingh
Quartz | Level 8

But the code works fine. The variable is created and there are no error or warning.

koyelghosh
Lapis Lazuli | Level 10

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.

Reeza
Super User
Which IDE are you using? EG, Base or SAS Studio? It varies between them. Studio > EG > Base.
Base hasn't been updated in years, EG & Studio are still being updated, Studio is more up to date.
thepushkarsingh
Quartz | Level 8
I am using SAS EG.
Tom
Super User Tom
Super User

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.

thepushkarsingh
Quartz | Level 8
Many thanks.

SAS Innovate 2025: Call for Content

Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 25. Read more here about why you should contribute and what is in it for you!

Submit your idea!

Mastering the WHERE Clause in PROC SQL

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.

Discussion stats
  • 7 replies
  • 3406 views
  • 3 likes
  • 4 in conversation