BookmarkSubscribeRSS Feed
deleted_user
Not applicable
Hi,

I am getting an error on this below code:

data svc(keep=aaa ddd);
set &libn1..svcs;
if cod=('21'and '31');
run;

Error:
NOTE 49-169: The meaning of an identifier after a quoted string may change in a future SAS release. Inserting white space between a quoted string and the succeeding identifier is recommended.

Thanks in advance.
Raj
2 REPLIES 2
Cynthia_sas
Diamond | Level 26
Hi:
I believe you are getting that message because you do not have a space:
[pre]
if cod=('21'and '31');
--
[/pre]
between the ' and the 'a' for and

However, it is probably a moot point, since the syntax of your IF statement is incorrect. For some examples of how to code an IF statement, refer to the documentation examples found here:
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000201978.htm
http://support.sas.com/documentation/cdl/en/lrdict/64316/HTML/default/viewer.htm#a000202239.htm
http://support.sas.com/documentation/cdl/en/lrcon/62955/HTML/default/viewer.htm#a000780367.htm

For one thing, it would be impossible for 1 variable to hold 2 values on a single observation so you would never find an observation where the value for COD was both '21' AND '31'. So I suspect you want to subset those observations where the value for code is either '21' or is '31'.

You could use either of these forms of subsetting IF:
[pre]
if cod='21' or cod='31';
OR
if cod in ('21', '31');
[/pre]

cynthia
deleted_user
Not applicable
Thanks Cynthia !!!

It works out !!

sas-innovate-2026-white.png



April 27 – 30 | Gaylord Texan | Grapevine, Texas

Registration is open

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!

Register now

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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
  • 2 replies
  • 1089 views
  • 0 likes
  • 2 in conversation