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 ...

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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
  • 628 views
  • 0 likes
  • 3 in conversation