Conditions often cause the SAS SQL optimizer
to choose the sort-merge algorithm, and techniques that improve sort
performance also improve sort-merge join performance. However, understanding
and using index and hash joins can provide performance gains. Sort-merge
is the algorithm that is selected most often by the SQL optimizer.
When index nested loop and hash join are eliminated as choices, a
sort-merge join or simple nested loop join is used. A sort-merge sorts
one table, stores the sorted intermediate table, sorts the second
table, and finally merges the two to form the join result. Use the Suggest Sort Merge Join property on the SQL Properties
pane to encourage a sort-merge. This property adds MAGIC=102 to the
PROC SQL invocation, as follows: proc sql _method magic=102;
.