BookmarkSubscribeRSS Feed
ssas
Calcite | Level 5
Hi,
i would like to know how many and 's or's we can use in a data step.
for example

data test1 test2 test3;
set soruce;
if type='a' or type= 'b3' or or type='a21' ................ then output test1;

/* loke wise how many or 's can i use with in a single if clause */

run;

thanks in advance

sams Message was edited by: sams1
3 REPLIES 3
deleted_user
Not applicable
Hi,

The answer is pretty much as many as you could possibily hope to use. No doubt there is a limit but I've never reached it. If you have a number of ORs or ANDs which gets anywhere near the limit I would suggest you need to code you data step differently.

I would however suggest, in the example you give, using the IN operator.

e.g.

if type in ('a' 'b3' 'a21') then output test1;

Hope that helps.
ssas
Calcite | Level 5
Excellent, many thanks for both of you.
My mind didn't striked about in operator.

Thanks for u r help
Bill
Quartz | Level 8
most probably quite a few ...

To reduce typing, consider

if type in ('a', 'a21', 'b3') then ...

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
  • 3 replies
  • 573 views
  • 0 likes
  • 3 in conversation