| Date: | Tue, 8 Dec 2009 13:09:55 -0800 |
| Reply-To: | "Choate, Paul@DDS" <Paul.Choate@DDS.CA.GOV> |
| Sender: | "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU> |
| From: | "Choate, Paul@DDS" <Paul.Choate@DDS.CA.GOV> |
| Subject: | Re: Help in joining two datasets |
|
| In-Reply-To: | <902122.26499.qm@web7702.mail.in.yahoo.com> |
| Content-Type: | text/plain; charset="iso-8859-1" |
Alex - as Proc Me suggests....
data ds1;
input field1 field2;
cards;
101 10
102 13
103 18
104 22
105 35
;
data ds2;
input field1 field2;
cards;
101 10
102 11
103 15
104 22
105 30
;
proc sql;
create TABLE ds3 as
select ds1.field1, ds1.field2
from ds1 join ds2
on ds1.field1=ds2.field1 and
abs(ds1.field2-ds2.field2)<3;
quit;
Paul Choate
DDS Data Extraction
(916) 654-2160
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Alex S
Sent: Tuesday, December 08, 2009 3:54 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: Help in joining two datasets
Hi All, Good morning to you.I have two datasets ( ds1 & ds2) with two columns on both datasets (field1 & field2). what i want is... i want to join these two tables based on field1 and field2. I can join ds1.field1=ds2.field1, but when we join the ds1.field2=ds2.field2, the values(field2) between two table should be plus or minus 2. mathmatically ds1.field2(+ or -)=ds2.field2(+ or -)
Example codeData ds1;input field1 field2;cards;101 10102 13103 18104 22105 35;
Data ds2;input field1 field2;cards;101 10102 11103 15104 22105 30;
output should be:field1 field2101 10102 13103 18104 22
let me know if you need more information.
Thanks 'n' Regards
alex .S.
The INTERNET now has a personality. YOURS! See your Yahoo! Homepage. http://in.yahoo.com/
|