give this a whirl... proc sql;
create table test as
select rga.cd_rga,sousc.no_police
from
(SELECT * FROM PSAEU11.db_dossier where cd_dossier = 'SOUSC' and lp_etat_doss not in ('ANNUL','A30','IMPAY') and no_police = 'I99300001') sousc
left join PSAEU11.db_garantie gar on sousc.is_protocole=gar.is_protocole and gar.cd_garantie='DEDIE'
left join PSAEU11.db_ctrat_support ctrats on ctrats.is_garantie = gar.is_garantie and ctrats.is_dossier = sousc.is_dossier
left join PSAEU11.db_param_mandat_op mandaop on ctrats.is_param_mandat_op = mandaop.is_param_mandat_op
left join PSAEU11.db_rga rga on mandaop.is_rga=rga.is_rga
;
quit;
... View more