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
SAS Super FREQ
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-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 2 replies
  • 633 views
  • 0 likes
  • 2 in conversation