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

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 🙂

1 ACCEPTED SOLUTION

Accepted Solutions
Cynthia_sas
SAS Super FREQ

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

View solution in original post

2 REPLIES 2
Cynthia_sas
SAS Super FREQ

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

f_rederik
Obsidian | Level 7

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.

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

What is Bayesian Analysis?

Learn the difference between classical and Bayesian statistical approaches and see a few PROC examples to perform Bayesian analysis in this video.

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