Previous PageNext Page

Logical Comparisons: Multiple OR Operators versus the IN Operator

Which is more efficient?

Code 1:

Data Groups;
	input group $ @@;
	if group in ("A", "B", "C");
	datalines;
A B C D B C B D B A B R B C B D B X B B C
;

Code 2:

Data Groups;
	input group $ @@;
	if group in ("B", "C", "A");
	datalines;
A B C D B C B D B A B R B C B D B X B B C
;

Code 3:

Data Groups;
	input group $ @@;
	if group="A" OR group="B" OR group="C";
	datalines;
A B C D B C B D B A B R B C B D B X B B C
;

Code 4:

Data Groups;
	input group $ @@;
	if group="B" OR group="C" OR group="A";
	datalines;
A B C D B C B D B A B R B C B D B X B B C
;

Previous PageTable Of ContentsNext Page