I am trying with SAS to read the two files File1 and File2 with key and data as columns. IF the keys are equal read the first file till the key changes.Then compare the keys again if the File1 key is greater than the other read the File2 or else if the File2 key is greater than the other read the File1. I need some help on the code.
There are several ways to do what you want to do...a MERGE, an SQL Join, using the POINT= option, using KEY=. There are pros and cons to each method, depending on your data, whether it's indexed, how big the files are, whether you want only matches or you also want matches and nonmatches.
You best bet for help in this regard is to look in the documentation for examples of combining data sets (which you will find under the above statements) or to contact Tech Support for help with your particular set of data and your particular programming problem.