I believe that if making an index on the key ( in this case x ) in table a may be a better choice if there are high frequency similar queries. 等 (you) 有空测试.
data c;
input company year price;
cards;
1 1 3
1 2 5
2 1 2
2 2 3
3 1 3
3 2 7
;run;
data d;
input company;
cards;
2
3
;run;
proc sql;
create table f as
select * from c join d on c.company=d.company;
run;