I am not sure I understand what your code is doing. I have tryed two consecutive join as below. What do you think about that? proc sql; create table provnbqt1 as select table1.*, table5.dtcreationVIP, table5.hrcreationVIP, table5.VIP, table6.clicassure, datepart(table6.started) as dtcreationCLA format yymmdd10., timepart(table6.started) as hrcreationCLA format time8., table7.rentecoll, datepart(table7.started) as dtcreationRCO format yymmdd10., timepart(table7.started) as hrcreationRCO format time8., table8.web FROM provnbqt as table1 left join ref_vip as table5 on table1.ACCOUNTNUMBER = table5.ACCOUNT_NUMBER and table1.dttrnsys = table5.dtcreationVIP /*201607 CP je veux ajouter la provenace clic assure la note est au niveau account et on a un delai de 7 jours admissible on associe que les soum on va passer par une provenance tempo pour les ventes*/ left join clicassure as table6 on table1.ACCOUNTNUMBER = table6.primaryentityid and datepart(table6.started)<=table1.dttrnsys<=sum(datepart(table6.started),7)/* and table1.type_lot="QT"*/ /*201609 CP je veux ajouter la provenace rente collective la note est au niveau account et on a un delai de 7 jours admissible on associe que les soum on va passer par une provenance tempo pour les ventes*/ left join rente_coll as table7 on table1.ACCOUNTNUMBER = table7.primaryentityid and datepart(table7.started)<=table1.dttrnsys<=sum(datepart(table7.started),7) /*and table1.type_lot="QT"*/ left join SoumEnLigne (where=( PRIMARYENTITYCLASS eq "Quote")) as table8 on table1.POLICYNUMBER = table8.primaryentityid and datepart(table8.started)<=table1.dttrnsys<=sum(datepart(table8.started),7) left join SoumEnLigne (where =(PRIMARYENTITYCLASS eq "Account")) as table9 on table1.ACCOUNTNUMBER = table9.primaryentityid and datepart(table9.started)<=table1.dttrnsys<=sum(datepart(table9.started),7) /*and table1.type_lot="QT"*/ ; QUIT;
... View more