|
If I understand the SQL query properly, you want to create a table
containing all variables from TABLE1 for observations from TABLE1 which
match on COLUMN_NAME to TABLE2.
I haven't used the EXIST condition before, but couldn't the query be
re-written like this?
proc sql;
create table new as
select a.*
from table1 a, table2 b
where a.column_name = b.column_name
;
quit;
If you want to use a DATA step merge, both data sets will have to be
sorted or indexed on the variable used to merge.
Proc sort data = table1;
By column_name;
Run;
Proc sort data = table2 (keep=column_name);
By column_name;
Run;
Data new;
Merge table1 (in=a) table2 (in=b);
By column_name;
If a and b;
Run;
Jack Clark
Research Analyst
Center for Health Program Development and Management
University of Maryland, Baltimore County
-----Original Message-----
From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of
boobeshgroups@gmail.com
Sent: Wednesday, April 25, 2007 1:02 AM
To: SAS-L@LISTSERV.UGA.EDU
Subject: convert proc sql to data step
hi ,
Can u please help in converting the below code to SAS data step
code...
the performance of this code buggs...it takes nearly 20 mins...
the size of the table is
table1 45000 records.
table2 25000 records.
proc sql;
create table new as select * from table1 a where exists
(select 1 from table2 b where b.column_name = a.column_name);
quit;
thanks in advance,]
|