There isn’t a guarantee of getting the datagroup contents back in the same order they’re listed (whether using an internal or external datagroup). I think this is due to hashing that LTM performs when parsing the datagroup entries.
If you need to get them in a specific order, you could prepend a digit or letter to the class element and then sort by that. But I think that could be computationally expensive.
Out of curiosity, why do you need the elements back in order?
I was interested in gathering the stats that come along with some of the pools but reported on separate lines. Working without them or pulling them via another method seems to be the best options.