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.
Don't miss out on SAS Innovate - Register now for the FREE Livestream!
Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.
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.