Date: Thu, 1 May 2008 18:14:18 -0700
Reply-To: newbie <itissandeep@GMAIL.COM>
Sender: "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From: newbie <itissandeep@GMAIL.COM>
Organization: http://groups.google.com
Subject: OR condition in PROC SQL
Content-Type: text/plain; charset=ISO-8859-1
Hi all,
I'm trying to use PROC SQL to create a new dataset based on two other
datasets.
It looks something like the following:
Proc SQL;
CREATE TABLE C AS
SELECT * FROM A, B
WHERE A.Field1 = B.Field1
AND
A.Field2 =B.Field2 OR
A.Field3 =B.Field2 OR
A.Field4 =B.Field2 OR
...
...
...
A.Field100 =B.Field2 ;
QUIT;
This is what I want it to do:
I have 100 date fields which are to be compared. If the ID (Field1)
matches in any of the records in A and in B AND the any of the 100
date fields in the same record in A also matches fixed date field in B
then I want to include the complete record of dataset A + dataset B.
But apparently I am getting 0 records, though I know there are some
matching.
Can somebody tell me what is wrong or suggest a better procedure ?
Thanks a ton