BookmarkSubscribeRSS Feed
phadnismukta
Fluorite | Level 6

I have a data with zip code and acc_nbr... when I sorted the data by zip code on different days, got same acct_nbr on different positions in the output data. Is it possible?

3 REPLIES 3
Reeza
Super User

It’s possible...one way would be if you had ties in the data and they were sorted differently previously to this sort. So you have a different data set order passed to the proc sort with ties. If you have ties it’s best to do a double sort,with the first sort using an extra variable to control the order. 

if you’re running the exact same program again, it’s unlikely. and I’d  guess 99% of cases are some form of user error - like above. 


@phadnismukta wrote:

I have a data with zip code and acc_nbr... when I sorted the data by zip code on different days, got same acct_nbr on different positions in the output data. Is it possible?


 

Patrick
Opal | Level 21

If you only sort by zip_number and not also by account_number within a zip number then yes, nothing will control the order of the account_numbers.

If your source table is a SAS data set (and not a database table) then using proc sort option EQUALS will return rows in the same "sub-" order as they were in the source table.

How to Concatenate Values

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 3 replies
  • 1759 views
  • 0 likes
  • 4 in conversation