If each PLACE_ID is only supposed to fulfill the join condition once, then you can use this: PROC SQL outobs=3;
SELECT REG.REGION, ORG.ORG, PLC.PLACE, SPT.SPOT
from REGION REG INNER JOIN
ORGANIZATION ORG ON REG.REG_ID = ORG.REG_ID
INNER JOIN
PLACE PLC ON PLC.ORG_ID = ORG.ORG_ID
INNER JOIN
SPOT SPT ON SPT.PLACE_ID = PLC.PLACE_ID where ORG.ORG_ID = 32158675;
quit; Otherwise, use a temporary table: proc sql noprint outobs=3;
create table PLACE_TEMP as select place_id, place
from PLACE;
quit;
PROC SQL;
SELECT REG.REGION, ORG.ORG, PLC.PLACE, SPT.SPOT
from REGION REG INNER JOIN
ORGANIZATION ORG ON REG.REG_ID = ORG.REG_ID
INNER JOIN
PLACE_TEMP PLC ON PLC.ORG_ID = ORG.ORG_ID
INNER JOIN
SPOT SPT ON SPT.PLACE_ID = PLC.PLACE_ID where ORG.ORG_ID = 32158675;
quit;
... View more