Equal Join of Two Files by Dr. Alex Yu Problem There are two files: File A and File B. File A has some observations that File B doesn't have and vice versa. I want to merge two files if and only if the observations occur in both places. Solution In a relational database (RDE) this is so-called "equal join." You can do an equal join in a RDB by just dragging the field of one table to the identical field in another table. In SAS you do the following: * Assume that in this case you have social security number in both files. * Data file_a; ... temp_id = ssn; proc sort; by ssn; Data file_b; ... temp_id2 = ssn; proc sort; by ssn; Data all; merge file_a file_b; by ssn; if temp_id = temp_id2;