proc sql; select fields,(select distinct field from table2 where table1.field1=filed2) from table1; quit;