Wednesday, December 29, 2010

SAS SET operator summary



1: A set operator works on the results of two SELECT clauses. This is unlike a join, which is implemented within the FROM clause of a single SELECT statement. 

2: Joins typically align rows and accrete (that is, accumulate or collect) columns; set operator align columns and accrete rows. That is, Joins perform side-by-side (horizontal) combinations, in contrast Set operator perform end-to-end (vertical) combination.

3: CORRESPONGING directs the SQL processor to align like-named columns.

4: When set operators are used, the programmer must make sure that aligned columns are compatible with respect to type.  

5: ALL is used to purge duplicate rows.

6: The accretion rule for the UNION operator is that a row appears in the result if it appears in either data source.

7: INTERSECT accepts only rows in both data source.

8: If F represents the number of times a particular row appears in the first source (the result of the first SELECT clause) and S represents the count from the second source, the row will appear MIN(F,S) times in the INTERSECT result.

9: If F represents the number of times a particular row appears in the first source (the result of the first SELECT clause) and S represents the count from the second source, the row will appear MAX(0,F-S) times in the EXCEPT ALL result.


No comments:

Post a Comment