As the first step in the decommissioning of sasCommunity.org the site has been converted to read-only mode.
Here are some tips for How to share your SAS knowledge with your professional network.
Joining Data: Data Step Merge or SQL?
Faisal Dosani, RBC Royal Bank, Toronto, ON
This paper explores the joining of datasets / tables using both the data step MERGE and PROC SQL. Similarities between the two methods are identified and occasions when one method might be preferred over the other are discussed. Specific issues relating to INNER, OUTER and FULL joins are covered, as are the vagaries of the SQL ON vs. WHERE clauses. An array of examples will illustrate exactly how joins are accomplished in both data step and SQL environments. Included in the presentation is a method of displaying SQL's inner workings providing hints for query optimization.
- Read the full paper, with plenty of example code.
- SAS Institute Inc. 2006. SAS OnlineDoc® 9.1.3. Cary, NC: SAS Institute Inc.
- Lafler, Kirk. 2002. "A Visual Introduction to SQL Joins" The Twenty-Seventh Annual SAS® Users Group International Conference Proceedings, Orlando, FL. (June 22, 2007).
- Raithel, Michael A. 2005. "The Basics of Using SAS® Indexes" Proceedings of the Thirtieth Annual SAS® Users Group International Conference, Philadelphia, PA. (January 2, 2008).
- Dickstein, Craig; Pass, Ray; Davis, Michael L. 2007. DATA Step vs. PROC SQL: What's a neophyte to do? Proceedings of the SAS® Global Forum 2007 Conference, Orlando, FL. (January 5, 2008).
- Cheng, Wei. 2004. "Helpful Undocumented Features in SAS®" Proceedings of the Twenty-Ninth Annual SAS® Users Group International Conference, Montreal, QC. (January 5, 2008).