Sorting the variables is kinda obsolete, as sorting different variables on their value is a bit weird. There are ways to sort, but you would somehow need to store the different variable names as well. What I would suggest is open a sorted window, dump the values in it, they will be sorted, and extract the sorted list from there.

Perhaps if you describe what you intend to do here, we could suggest alternate ways...