Hi, I`m looking for an equivalent of the below code in Data step HASH join. proc sql; create table rllp2 as select distinct a.*, b.enam as name,b.position,b.orid,b.ccid_1 as ccid,b.region1 as region max(a.BEGD,b.BEGD) as BEGD,min(a.ENDD,b.ENDD) as ENDD from rllp3 as a left join rllp1 as b on a.position_id_k = b.position_id_1 and ((a.BEGD BETWEEN b.BEGD and b.ENDD) or (a.ENDD BETWEEN b.BEGD and b.ENDD) or (a.BEGD >= b.BEGD and a.ENDD <= b.ENDD) or (a.BEGD <= b.BEGD and a.ENDD >= b.ENDD)) order by position,BEGD,ENDD; Not sure how to add the distinct ,extra join conditions and order by in a single datas tep. DATA MI ; IF 0 THEN SET rllp1; DECLARE hash VS(hashexp:10, dataset:"rllp1"); VS.definekey('position_id_k,'position_id_1'); VS.definedata(all:'Y'); VS.definedone(); DO UNTIL(eof); SET rllp3end=eof; IF VS.find()=0 THEN OUTPUT; ELSE DO; CALL missing( a1---b1); OUTPUT; END; END; STOP ; RUN; Kindly suggest some methods
... View more