BookmarkSubscribeRSS Feed
☑ This topic is solved. Need further help from the community? Please sign in and ask a new question.
PrinceAde
Obsidian | Level 7
The above code is supposed to be sorted in ascending town, descending debt and ascending accountnumber.
From the result, the accountnumber does not look sorted to me.
Can anyone help please. Thank you
The link; https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n0zs02iixw2lban15cxp9qe1cbok.htm#n0zs02i...
1 ACCEPTED SOLUTION

Accepted Solutions
FreelanceReinh
Jade | Level 19

Hello @PrinceAde and welcome to the SAS Support Communities!

 

Sorting by ascending town, descending debt and ascending account number means a kind of hierarchy: Only within groups of observations for the same town the second sort key, descending debt, is actually applied (as a "tie-breaker"). Similarly, the effect of the third sort key, accountnumber, can only be visible within groups of observations with the same values in both town and debt. Only three observations happen to meet this fairly strong criterion: those with town='Apex' and debt=37.95. The account numbers of these three observations are indeed in ascending order: 3131, 5108, 9923. Without those "doubly tied" observations even sorting by descending accountnumber (in the third place) would make no difference and the account numbers would typically look like not sorted at all (i.e., similar to what they look like now, with the sorting effectively limited to just 3 out of 14 observations).

View solution in original post

5 REPLIES 5
PaigeMiller
Diamond | Level 26

Please be specific, where do you think the sorting of account number is incorrect?

--
Paige Miller
Kurt_Bremser
Super User

@PrinceAde wrote:
The above code is supposed to be sorted in ascending town, descending debt and ascending accountnumber.
From the result, the accountnumber does not look sorted to me.
Can anyone help please. Thank you
The link; https://documentation.sas.com/doc/en/pgmsascdc/9.4_3.5/proc/n0zs02iixw2lban15cxp9qe1cbok.htm#n0zs02i...

I see no code in your post, please post it.

maguiremq
SAS Super FREQ

Hi @PrinceAde, echoing others, please post the code and your results.

FreelanceReinh
Jade | Level 19

Hello @PrinceAde and welcome to the SAS Support Communities!

 

Sorting by ascending town, descending debt and ascending account number means a kind of hierarchy: Only within groups of observations for the same town the second sort key, descending debt, is actually applied (as a "tie-breaker"). Similarly, the effect of the third sort key, accountnumber, can only be visible within groups of observations with the same values in both town and debt. Only three observations happen to meet this fairly strong criterion: those with town='Apex' and debt=37.95. The account numbers of these three observations are indeed in ascending order: 3131, 5108, 9923. Without those "doubly tied" observations even sorting by descending accountnumber (in the third place) would make no difference and the account numbers would typically look like not sorted at all (i.e., similar to what they look like now, with the sorting effectively limited to just 3 out of 14 observations).

PrinceAde
Obsidian | Level 7
Okay, I can see that now. This was very
helpful, thank you very much, sir.

Ready to join fellow brilliant minds for the SAS Hackathon?

Build your skills. Make connections. Enjoy creative freedom. Maybe change the world. Registration is now open through August 30th. Visit the SAS Hackathon homepage.

Register today!
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.

Click image to register for webinarClick image to register for webinar

Classroom Training Available!

Select SAS Training centers are offering in-person courses. View upcoming courses for:

View all other training opportunities.

Discussion stats
  • 5 replies
  • 746 views
  • 1 like
  • 5 in conversation