CSULB_STAT475_handout23

CSULB_STAT475_handout23 - STAT 475 Chapter 3 COMBINING...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
STAT 475 Chapter 3 COMBINING TABLES HORIZONTALLY USING PROC SQL Reference SAS Certification Prep Guide: Advanced Programming for SAS 9 A join in PROC SQL is a query that combines tables horizontally (that is, side by side) by combining rows. There are two types of joins: Inner join (only the rows that match across all tables are output) ***** ******* ****** *** Outer join (rows that match across tables plus nonmatching rows from one or more tables) ********** ********* *************** ************* ************ ******************* ************ ************* ******************* ********* *********** **************** USING INNER JOINS An inner join combines and displays only the rows form the first table that match rows from the second table, based on the matching criteria (also known as join conditions ) that are specified in the WHERE clause. Example. Consider two sets 1 One id varA 1 a 2 b 4 d Two id varB 2 x 3 y 5 v
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
The code below displays the observations with ids common to both tables. data one; input id varA $ @@; datalines; 1 a 2 b 4 d ; data two; input id varB $ @@; datalines; 2 x 3 y 5 v ; options nodate nonumber; title; proc sql; select * from one, two where one.id=two.id; quit; The output is id varA id varB ƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒƒ 2 b 2 x ELIMINATING DUPLICATE COLUMNS 2
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 12/14/2011 for the course STAT 475 taught by Professor Olgak during the Fall '11 term at CSU Long Beach.

Page1 / 7

CSULB_STAT475_handout23 - STAT 475 Chapter 3 COMBINING...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online