1 / 6

Chapter 3 Supplement

Chapter 3 Supplement. Self-joins Using PROC SQL. Self-Joins. Self-joins, or Reflexive Joins are used to compare values within a data set Examples typically use equality operations to create a join. 2011 SEC Football Scores. Self-Joins.

reyna
Download Presentation

Chapter 3 Supplement

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Chapter 3 Supplement Self-joins Using PROC SQL

  2. Self-Joins • Self-joins, or Reflexive Joins are used to compare values within a data set • Examples typically use equality operations to create a join

  3. 2011 SEC Football Scores

  4. Self-Joins • Note that USC’s winning score on November 12 matches Mississippi State’s losing score on November 19 • We can record all such instances using a reflexive join • The reflexive join can look like an outer union

  5. Self-Join Syntax proc sql; select winner.wscore, winner.date, winner.wteam, loser.date, loser.lteam from secscores as winner, secscores as loser where winner.wscore=loser.lscore; quit;

  6. Self-Join Syntax • We do not have to use equality operators: proc sql; select winner.wscore, winner.date, winner.wteam, loser.date, loser.lteam from secscores as winner, secscores as loser where winner.wscorelt loser.lscore; quit;

More Related