BookmarkSubscribeRSS Feed
whymath
Lapis Lazuli | Level 10

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:

black.png

 

If I just remove the comma between 'Alice' and 'Jane' and run this program again , the color of %put statement is blue:

blue.png

 

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.

3 REPLIES 3
whymath
Lapis Lazuli | Level 10
It behaves the same in my SAS DMS and Studio:

DMS version: 9.04.01M7P08052020
Studio version: 9.04.01M6P11072018
japelin
Rhodochrosite | Level 12
This is an interesting phenomenon.

If I submit "options nonotes", I got black text by your code.
Is it some kind of bug that causes the NOTE flag to be turned on when the SYSERR value is 1012?
ballardw
Super User

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

 

hackathon24-white-horiz.png

The 2025 SAS Hackathon Kicks Off on June 11!

Watch the live Hackathon Kickoff to get all the essential information about the SAS Hackathon—including how to join, how to participate, and expert tips for success.

YouTube LinkedIn

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1033 views
  • 1 like
  • 3 in conversation