Desktop productivity for business analysts and programmers

Reordering the output in a summary in SAS EG

Accepted Solution Solved
Reply
Contributor JSJ
Contributor
Posts: 43
Accepted Solution

Reordering the output in a summary in SAS EG

Hi,

 

I would like to put my output from my summary table in a specific order.

 

I created the summary and then output the results to a work file, so I can reorder it. Now it is ordering in alpabetical order.

 

One way I thought of is to create a calculated value based on the row, and then another calculated value with a case to assign my row number to sort--

 

Anyone have a function for row?  Monotonic() returns odd results when I try to add to it!

 

In the example attached, I would like Category 3 to be moved to the bottom of the report after Category 2.

 

Any ideas?  Thanks in advance.

Jo


Accepted Solutions
Solution
‎05-11-2016 10:32 AM
Contributor JSJ
Contributor
Posts: 43

Re: Reordering the output in a summary in SAS EG

I heeded the warning about monotonic!

 

I tried going into the code and changing the order statements in the PROC Tabulate.

But what ultimately worked was simply padding the category that I wanted first with 3 blanks, next category 2 blanks, etc.

 

Worked!

 

View solution in original post


All Replies
Contributor JSJ
Contributor
Posts: 43

Re: Reordering the output in a summary in SAS EG

I did get my lines reordered by using monotonic() in one query to assign row number, and then a case statement t assign my summary row number in a subsequent query... Now to get it to output!
Trusted Advisor
Posts: 1,056

Re: Reordering the output in a summary in SAS EG

Be careful about using monotonic, or trying to do this in SQL. SQL is an inherently set-oriented language, and doesn't do "do this line before this line" types of operations well.

 

In your case, it looks to me like you could assign numeric values for your categories in whatever order you want, and then use formats to create the nicely labelled output.

 

Tom

Solution
‎05-11-2016 10:32 AM
Contributor JSJ
Contributor
Posts: 43

Re: Reordering the output in a summary in SAS EG

I heeded the warning about monotonic!

 

I tried going into the code and changing the order statements in the PROC Tabulate.

But what ultimately worked was simply padding the category that I wanted first with 3 blanks, next category 2 blanks, etc.

 

Worked!

 

☑ This topic is SOLVED.

Need further help from the community? Please ask a new question.

Discussion stats
  • 3 replies
  • 279 views
  • 1 like
  • 2 in conversation