Hello eveybody. I am writing SAS program and I found this wired phenomenon.
I submit code like this:
data _null_;
set sashelp.class;
select(name);
when ('Alice','Jane');
when ('John');
other;
end;
run;
%put this is test text;
The color of %put statement is black:
If I just remove the comma between 'Alice' and 'Jane' and run this program again , the color of %put statement is blue:
Why the text color of %put statement turn blue without 'NOTE:' prefix?
Ps:
1. I have tried other syntax error but they all failed to turn text color of %put statement blue.
2. If I delete "when ('John');", text color of %put statement will always be black.
Seems to be related to not having an operation after the WHEN.
Note that is, with something after the when, generates a different error message and the macro put text is black.
61 data _null_;
62 set sashelp.class;
63 select(name);
64 when ('Alice' 'Jane') Put "Name is" Name;
------
388
76
65 when ('John') ;
----
346
ERROR 388-185: Expecting an arithmetic operator.
ERROR 76-322: Syntax error, statement will be ignored.
ERROR 346-185: No executable statement preceding WHEN statement.
66 other;
67 end;
68 run;
NOTE: The SAS System stopped processing this step because of errors.
NOTE: DATA statement used (Total process time):
real time 0.00 seconds
cpu time 0.00 seconds
69 %put this is test text;
this is test text
So I would guess that it has something to do with the particular class of error setting a property way in the background
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
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.
Ready to level-up your skills? Choose your own adventure.