The key is to use PROC SORT to sort the bar data, as in the full-code example above: proc sort…