BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
JSJ
Quartz | Level 8 JSJ
Quartz | Level 8

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

1 ACCEPTED SOLUTION

Accepted Solutions
JSJ
Quartz | Level 8 JSJ
Quartz | Level 8

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

3 REPLIES 3
JSJ
Quartz | Level 8 JSJ
Quartz | Level 8
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!
TomKari
Onyx | Level 15

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

JSJ
Quartz | Level 8 JSJ
Quartz | Level 8

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!

 

sas-innovate-2024.png

Join us for SAS Innovate April 16-19 at the Aria in Las Vegas. Bring the team and save big with our group pricing for a limited time only.

Pre-conference courses and tutorials are filling up fast and are always a sellout. Register today to reserve your seat.

 

Register now!

SAS Enterprise Guide vs. SAS Studio

What’s the difference between SAS Enterprise Guide and SAS Studio? How are they similar? Just ask SAS’ Danny Modlin.

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
  • 3 replies
  • 843 views
  • 1 like
  • 2 in conversation