Thanks for your replies! :O) I'm doing a left join onto a performance table and restricting by outcome month, but the performance file will get very large over time. My question was around the location of the where clause, at present it's in the where select at the bottom, but I wondered if anyone knew for efficiency if it was better to put this after the table reference in the from statement? The code below worked using ODBC, but when I run it in enterprise guide it gives a syntax error for the and line - is this because there is more than one variable in the select statement? At the moment, the datasets are very small, but when we switch portfolio, optimising the code below is key! proc sql; create table cj as select A.*, B.* from &mthy. a left join perform.&perf_file. b on a.cs_id = b.cs_id and (cs_id, arrears) IN (select cs_id, MAX(arrears) as flag_3 from perform.&perf_file. b where '01DEC2011'D <= B.outcome_month <= '28FEB2012'D group by B.cs_id) ;QUIT;
... View more