LISTSERV at the University of Georgia
Menubar Imagemap
Home Browse Manage Request Manuals Register
Previous messageNext messagePrevious in topicNext in topicPrevious by same authorNext by same authorPrevious page (March 2002, week 1)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Tue, 5 Mar 2002 13:00:39 -0500
Reply-To:   Francis Harvey <HARVEYF1@WESTAT.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   Francis Harvey <HARVEYF1@WESTAT.COM>
Subject:   Re: SQL logic
Comments:   To: SAS-L@LISTSERV.VT.EDU
Content-Type:   text/plain; charset="iso-8859-1"

Greetings Peter,

I would expect the following code to work:

proc sql; select a.idvar as a, b.idvar as b, c.idvar as c from a left join b on a.idvar = b.idvar left join c on a.idvar = c.idvar; quit;

Francis R. Harvey III WB303, x3952 harveyf1@westat.com

VB programmers know the wisdom of Nothing

> -----Original Message----- > From: Peter Baade [mailto:Peter_Baade@HEALTH.QLD.GOV.AU] > Sent: Tuesday, March 05, 2002 1:15 AM > To: SAS-L@LISTSERV.VT.EDU > Subject: SQL logic > > > Hi > > I have three datasets, each with a unique ID variable (IDVAR). > > The first dataset (A) has one record for each person. The > second and third datasets (B and C) have one record per > person, but not necessarily for all people. > > I was using SQL to join these, but if I use the where statement > IF A.IDVAR=B.IDVAR AND A.IDVAR=C.IDVAR > then only those records with data in each dataset are pulled out. > > So, pulling out a paper by Christina Williams (Proc SQL for > Data step die hards), I find that using a LEFT JOIN would be > better logic. However, it seems as if this only works for two > datasets, not three. > > Is there some trival SQL procedure that does what I want? Its > more the logic that I'm trying to find, not necessarily the > specific code. > > Thanks for any advice, and my apologies if I've missed some > important piece of information in the above question :-) > > Peter. <snip>


Back to: Top of message | Previous page | Main SAS-L page