And what if I have dataset like below that d1 not change but d2 contain permno1, and d2 contain permno with different date from 1996 till now first one has say like below: permno1 date 12345 20141111 23456 20141113 the second one has like below: permno2 date 12345 20141111 23456 20141111 34567 20141111 45678 20141111 56789 20141111 12345 20141113 23456 20141113 34567 20141113 67890 20141113 I want to get: where permno1<>permno2 permno1 permno2 date 12345 23456 20141111 12345 34567 20141111 12345 45678 20141111 12345 56789 20141111 23456 12345 20141113 23456 34567 20141113 23456 67890 20141113 How should I write the code? proc sql; create table d as select a.permno1, b.permno2, b.date from d1 as a, d2 as b where a.date-10<=b.date<=a.date+10 and a.permno1<>b.permno2; then what if there are 1billion data? it will take a long time to finish the sql.
... View more