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.
Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!
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.