Dear experts,
I'm trying to sort a column which has records like 'AA0276', 'A2B5Q', 'AB8ER', ...
After I sort the data, I'm running a data step and use the sorted column in a by statement.
The data step returns a ERROR which indicates that the by variable couldn't sorted for the values like 'AA0276' which have two consequent character values.
ERROR: Error: BY variables are not properly sorted.
How can I fix this problem?
If SAS says that your data is not sorted by that variable, it is not.
Post some sample data and your code.
Yes, that's obvious from the log but if you read my 2nd sentence you would see that I've sorted the data (using Proc Sort), it is sorted.
You'll have to post the log. I can think of several possibilities, but I'm not about to explain them all in detail just in case one of them matches the situation you are encountering.
@KaiBasch wrote:
Yes, that's obvious from the log but if you read my 2nd sentence you would see that I've sorted the data (using Proc Sort), it is sorted.
Post your full code and log. Obviously SAS doesn't think the data set is sorted for some reason.
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Learn how use the CAT functions in SAS to join values from multiple variables into a single value.
Find more tutorials on the SAS Users YouTube channel.
Ready to level-up your skills? Choose your own adventure.