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 16:14:59 +1000
Reply-To:     Peter Baade <Peter_Baade@HEALTH.QLD.GOV.AU>
Sender:       "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:         Peter Baade <Peter_Baade@HEALTH.QLD.GOV.AU>
Subject:      SQL logic
Content-Type: multipart/mixed;

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.

********************************************************************** This e-mail, including any attachments sent with it, is confidential and for the sole use of the intended recipient(s). This confidentiality is not waived or lost if you receive it and you are not the intended recipient(s), or if it is transmitted/ received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this e-mail is prohibited. It may be subject to a statutory duty of confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this e-mail in error, you are asked to immediately notify the sender by telephone or by return e-mail. You should also delete this e-mail message and destroy any hard copies produced. **********************************************************************


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <HTML><HEAD> <META content="text/html; charset=us-ascii" http-equiv=Content-Type> <META content="MSHTML 5.00.2919.6307" name=GENERATOR></HEAD> <BODY style="FONT: 8pt MS Sans Serif; MARGIN-LEFT: 2px; MARGIN-TOP: 2px"> <DIV>Hi </DIV> <DIV>&nbsp;</DIV> <DIV><FONT size=1>I have three datasets, each with a unique ID variable (IDVAR).</FONT></DIV> <DIV>&nbsp;</DIV> <DIV>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.</DIV> <DIV>&nbsp;</DIV> <DIV>I was using SQL to join these, but if I use the where statement </DIV> <DIV>IF A.IDVAR=B.IDVAR AND A.IDVAR=C.IDVAR </DIV> <DIV>then only those records with data in each dataset are pulled out.</DIV> <DIV>&nbsp;</DIV> <DIV>So, pulling out a paper by Christina Williams (Proc SQL for Data step&nbsp;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.</DIV> <DIV>&nbsp;</DIV> <DIV>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.</DIV> <DIV>&nbsp;</DIV> <DIV>Thanks for any advice, and my apologies if I've missed some important piece of information in the above question :-)</DIV> <DIV>&nbsp;</DIV> <DIV>Peter.</DIV> <DIV>&nbsp;</DIV></BODY></HTML>


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