Features: |
GROUP BY clause HAVING clause
|
Table names: | STORES |
proc sql; title 'Each House and the Closest Store'; select house, store label='Closest Store', sqrt((abs(s.x-h.x)**2)+(abs(h.y-s.y)**2)) as dist label='Distance' format=4.2 from stores s, houses h
group by house having dist=min(dist);
proc sql; title 'Each House and the Closest Store'; select house, store label='Closest Store', sqrt((abs(s.x-h.x)**2)+(abs(h.y-s.y)**2)) as dist label='Distance' format=4.2 from stores s, houses h