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 2011, week 2)Back to main SAS-L pageJoin or leave SAS-L (or change settings)ReplyPost a new messageSearchProportional fontNon-proportional font
Date:   Wed, 9 Mar 2011 12:43:23 -0800
Reply-To:   "DUELL, BOB (ATTCINW)" <BD9439@ATT.COM>
Sender:   "SAS(r) Discussion" <SAS-L@LISTSERV.UGA.EDU>
From:   "DUELL, BOB (ATTCINW)" <BD9439@ATT.COM>
Subject:   Re: SQL lookup - more efficient way?
Comments:   To: Michael Murff <mysasbox@GMAIL.COM>
In-Reply-To:   <AANLkTinhnRJPkvofLrjbwZfNY5wxTfoLNuxqG0P8PpM1@mail.gmail.com>
Content-Type:   text/plain; charset="us-ascii"

Try a correlated query instead of a join:

proc sql; select * from main a where exists ( select 1 from lookup b where a.num_x between b.beg_num and b.end_num ) order by id; quit;

-----Original Message----- From: SAS(r) Discussion [mailto:SAS-L@LISTSERV.UGA.EDU] On Behalf Of Michael Murff Sent: Wednesday, March 09, 2011 10:35 AM To: SAS-L@LISTSERV.UGA.EDU Subject: SQL lookup - more efficient way?

** Hi sas-l; ** my real tables are quite large; ** anybody know how to optimize this using ansi standard SQL syntax? ;

data main; do id=1 to 10; num_x=round(100*uniform(123),1); output; end; run;

data lookup; beg_num=1; end_num=10; output; beg_num=11; end_num=20; output; beg_num=21; end_num=30; output; run; proc sql; select * from main, lookup where num_x between beg_num and end_num order by id; quit; endsas;

** thank you in advance; ** Regards, Mike;


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