[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-656121-105":3,"detail-sidebar-cat-0-en-105":80,"doc-detail-656121-en":130},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":73,"head_meta":75,"extra_data":77,"updated_unix":79},105,"en","sas-global-forum-2012-programming-paper-251-2012-exploring-data-step-merges-and-proc-sql-joins","SAS Global Forum 2012 Programming - Paper 251-2012 - Exploring DATA Step Merges and PROC SQL Joins","","Explore the various DATA step merge and PROC SQL join processes, highlighting similarities and differences through practical examples. The presentation examines core objectives and principles for merging and joining tables, including coding constructs for inner and outer merges/joins and related hash techniques. Guidance covers conditional logic scenarios and best practices to choose effective approaches when combining SAS tables for insights into data relationships.",{"@graph":14,"@context":72},[15,34,55],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/document/","Document",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/document/technology/","Technology",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/sas-global-forum-2012-programming-paper-251-2012-exploring-data-step-merges-and-proc-sql-joins/656121/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/sas-global-forum-2012-programming-paper-251-2012-exploring-data-step-merges-and-proc-sql-joins/656121.png","ImageObject",300,407,{"name":42,"@type":43},"Finn","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-10-31","2026-10-25",true,{"@type":52,"interactionType":53,"userInteractionCount":33},"InteractionCounter",{"@type":54},"ViewAction",{"@type":56,"mainEntity":57},"FAQPage",[58,64,68],{"name":59,"@type":60,"acceptedAnswer":61},"What is the main goal of merging and joining tables in SAS?","Question",{"text":62,"@type":63},"Merging and joining combine rows side-by-side to gather and manipulate data across tables, enabling insights into relationships between data.","Answer",{"name":65,"@type":60,"acceptedAnswer":66},"What are key differences between a DATA step merge and a PROC SQL join?",{"text":67,"@type":63},"A DATA step merge requires sorting by BY-value and common variable names, and it overprints duplicate matching columns, while a PROC SQL join is portable, does not require sorting, and does not require common variable names.",{"name":69,"@type":60,"acceptedAnswer":70},"How does a Cartesian Product join relate to PROC SQL and the DATA step?",{"text":71,"@type":63},"A Cartesian Product produces all possible combinations of rows and columns from multiple tables; PROC SQL is the preferred approach because it uses coding characteristics like the absence of a WHERE clause and can yield very large result sets.","https://schema.org",{"og:url":32,"og:type":74,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":76,"canonical":32},"index,follow",{"doc_id":78,"site_id":7},656121,1793029733,{"code":4,"msg":81,"data":82},"success",[83,87,91,95,100,104,109,114,119,122,126],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":84,"show_sort_weight":85,"slug":86},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":88,"show_sort_weight":89,"slug":90},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":92,"show_sort_weight":93,"slug":94},"Exam",70,"exam",{"id":96,"doc_module":4,"doc_module_name":25,"category_name":97,"show_sort_weight":98,"slug":99},5,"Comic",60,"comic",{"id":101,"doc_module":4,"doc_module_name":25,"category_name":29,"show_sort_weight":102,"slug":103},6,50,"technology",{"id":105,"doc_module":4,"doc_module_name":25,"category_name":106,"show_sort_weight":107,"slug":108},7,"Healthcare",40,"healthcare",{"id":110,"doc_module":4,"doc_module_name":25,"category_name":111,"show_sort_weight":112,"slug":113},8,"Research & Report",30,"research-report",{"id":115,"doc_module":4,"doc_module_name":25,"category_name":116,"show_sort_weight":117,"slug":118},9,"Religion & Spirituality",20,"religion-spirituality",{"id":117,"doc_module":4,"doc_module_name":25,"category_name":120,"show_sort_weight":117,"slug":121},"World Cup","world-cup",{"id":123,"doc_module":4,"doc_module_name":25,"category_name":124,"show_sort_weight":123,"slug":125},10,"Lifestyle","lifestyle",{"id":127,"doc_module":4,"doc_module_name":25,"category_name":128,"show_sort_weight":96,"slug":129},19,"General","general",{"code":4,"msg":81,"data":131},{"doc_id":78,"user_id":132,"nickname":42,"user_avatar":133,"doc_module":4,"category_id":101,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":33,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":139,"language":140,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":141,"faqs":142,"seo_title":143,"seo_description":12,"update_tm":144,"read_time":145},34359740700684,"https://ap-avatar.wpscdn.com/avatar/1f400023980c374ae676?_k=1777273430885731487","SAS Global Forum 2012 Programming: Foundations and Fundamentals  \nPaper 251-2012  \nExploring DATA Step Merges and PROC SQL Joins  \nKirk Paul Lafler, Software Intelligence Corporation , Spring Valley, California  \nAbstract  \nExplore the various DATA step merge and PROC SQL join processes. This presentation examines the similarities and differences between each, and provides examples of effective coding techniques. Attendees examine the objectives and principles behind merging and joining, as well as the coding constructs associated with inner and outer merges and joins, and hash techniques.  \nIntroduction  \nThis paper illustrates the similarities and differences between the Base-SAS® software DATA step merge and PROC SQL join techniques. We’ll examine two “key” topics that most users are confronted with when working with their tables of data, conditional logic scenarios and merges/joins. This paper introduces brief explanations, guidelines and“simple” techniques for users to consider when confronted with conditional logic scenarios and merges/joins. You are encouraged to explore these and other techniques to make your SAS® experience an exciting one.  \nExample Tables  \nThe data used in all the examples in this paper consist of a selection of movies that I’ve viewed over the years. The Movies table contains four character columns: title, category, studio, and rating , and two numeric columns: length and year. The data stored in the Movies table is shown in Figure 1 below.  \nFigure 1. MOVIES Table  \nThe data stored in the ACTORS table consists of three columns: title, actor_leading, and actor_supporting, all of which are defined as character columns. The data stored in the Actors table is illustrated in Figure 2 below.  \nSAS Global Forum 2012 Programming: Foundations and Fundamentals  \nThe Process of Merging and Joining  \nA merge or join is the process of combining two or more tables’ side-by-side (horizontally) . Its purpose is to gather and manipulate data from across tables for exciting insights into data relationships. The process consists of a matching process between a table’s rows bringing together some or all of the tables’ contents, as illustrated in Figure 3.  \nTable One  Table Two  Table Three   \n. . .  \nFigure 3. The Process of Merging and Joining Tables  \nThe ability to define relationships between multiple tables and retrieve information based on these relationships is a powerful feature of the relational model. A merge or join of two or more tables provides a means of gathering and manipulating data. Merges and joins are specified on a minimum of two tables at a time, where a column from each table is used for the purpose of connecting the two tables. Connecting columns should have \"like\" values and the same column attributes since the processes’ success is dependent on these values.  \nContrasting Merges and Joins  \nThe difference between a DATA step merge and a join are subtle, but differences do exist.  \nMerge Features  \n1. Relevant only to the SAS System – not portable to other vendor data bases.  \n2. More steps are often needed than with the SQL procedure.  \n3. Data must first be sorted using by-value.  \n4. Requires common variable name.  \n5. Duplicate matching column is automatically overlaid.  \n6. Results are not automatically printed.  \nJoin Features  \n1. Portable to other vendor data bases.  \n2. Data does not need to be sorted using BY-value.  \n3. Does not require common variable name.  \n4. Duplicate matching column is not automatically overlaid.  \n5. Results are automatically printed unless NOPRINT option is specified.  \nCartesian Product  \nA Cartesian Product is defined as a result set of all the possible rows and columns contained in two or more data sets or tables. The DATA step doesn’t really lend itself to easily creating a Cartesian Product – PROC SQL is the desired approach. Its most noticeable coding characteristic is the absence of a WHERE-clause. The resulting set of data resulting from a Cartesi","cbCaiqawL2EWsloS","https://ap.wps.com/l/cbCaiqawL2EWsloS","pdf",920963,14,"English","# Abstract\n# Introduction\n# Example Tables\n# The Process of Merging and Joining\n## Contrasting Merges and Joins\n## Cartesian Product\n# Code\n# Results","[{\"question\":\"What is the main goal of merging and joining tables in SAS?\",\"answer\":\"Merging and joining combine rows side-by-side to gather and manipulate data across tables, enabling insights into relationships between data.\"},{\"question\":\"What are key differences between a DATA step merge and a PROC SQL join?\",\"answer\":\"A DATA step merge requires sorting by BY-value and common variable names, and it overprints duplicate matching columns, while a PROC SQL join is portable, does not require sorting, and does not require common variable names.\"},{\"question\":\"How does a Cartesian Product join relate to PROC SQL and the DATA step?\",\"answer\":\"A Cartesian Product produces all possible combinations of rows and columns from multiple tables; PROC SQL is the preferred approach because it uses coding characteristics like the absence of a WHERE clause and can yield very large result sets.\"}]","SAS Global Forum 2012 Programming - Paper 251-2012 - Exploring DATA Step Merges and PROC SQL Joins | PDF",1792966524,35]