"If neither contributing dataset is sorted, but one of them does fit into memory, PROC SQL will choose to process the query with a Hash Join (sqxjhsh)" (
http://support.sas.com/techsup/technote/ts553.html)
Make sure you have enough memory, and the SQL join will be as efficient as Yongyitian's program.
The option is buffersize (
http://support.sas.com/resources ... ings10/139-2010.pdf)
In either method, a Cartisian product is involved, so they should be spending very similar amount of time. It's not a problem as long as you can get your results in a reasonable amount of time.