Position the Legend The LOCATION= option places the legend inside of the plot area. The POSITION= option places the legend at the top right.
keylegend / location=inside position=topright; run;