turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Find a Community

- Home
- /
- SAS Programming
- /
- SAS Procedures
- /
- PROC TABULATE - Order by analysis variable?

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-16-2012 02:52 PM

I'm trying to build a Summary Table using PROC TABULATE, but I would like to order the table not by the class variable, but the measure.

Enterprise Guide got me started with the following code, but I'm struggling to find out how I can sort the table by the variable SUM_of_Saldo (rather than the SSB_Navn)

**PROC** **TABULATE**

DATA=WORK.QUERY_FOR_BSU_RK_TIMESNAP_0009

FORMAT=commax32.;

VAR SUM_of_Saldo ;

CLASS Periode / ORDER=UNFORMATTED MISSING;

CLASS SSB_Navn / ORDER=UNFORMATTED MISSING;

TABLE

/* ROW Statement */

SSB_Navn

all = 'Total' ,

/* COLUMN Statement */

Periode *(SUM_of_Saldo * Sum={LABEL="Sum"} )

all = 'Total' *(SUM_of_Saldo * Sum={LABEL="Sum"} ) ;

;

**RUN**;

Thanks for any pointers :-)

Accepted Solutions

Solution

01-16-2012
04:54 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-16-2012 04:54 PM

Hi:

This is a similar post and the answer is the same. It is easier to do what you want with PROC REPORT than with PROC TABULATE. The screenshot attached to this posting shows the type of code to use with PROC REPORT.

http://communities.sas.com/message/100730/#100730

The bottom line is that neither TABULATE nor REPORT will allow you to order on the equivalent of a statistic or calculated analysis variable. But if you create an ordering variable, then you can force PROC REPORT to show the data using the calculated amount (as shown in the screen shot where value C with a total of 15 is listed first).

cynthia

All Replies

Solution

01-16-2012
04:54 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-16-2012 04:54 PM

Hi:

This is a similar post and the answer is the same. It is easier to do what you want with PROC REPORT than with PROC TABULATE. The screenshot attached to this posting shows the type of code to use with PROC REPORT.

http://communities.sas.com/message/100730/#100730

The bottom line is that neither TABULATE nor REPORT will allow you to order on the equivalent of a statistic or calculated analysis variable. But if you create an ordering variable, then you can force PROC REPORT to show the data using the calculated amount (as shown in the screen shot where value C with a total of 15 is listed first).

cynthia

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

01-17-2012 01:21 AM

Thanks Cynthia

I know I should probably spend some more time getting to grips with the code, but I seem to always manage somehow using Enterprise Guide...

Seems EG does not have a built in task for PROC REPORT, so just need to get my old coding fingers dirty ;-)

Thanks for your help.