BookmarkSubscribeRSS Feed
Ronein
Onyx | Level 15

Hello

I want that the name of the column of Sum of x will be  X in MPLN

Why I get name "SUM"?

Why one row above I get name "X in MPLN"?

input ID g X;
cards;
1 2 10
2 3 15
3 2 20
4 5 25
5 8 40
6 8 35
7 2 30
8 4 20
;
run;
proc report data=raw  nowd;
column g x,(n sum  pctn pctsum);
define g /group    style(column)=header;
define x/"X in MPLN" analysis sum;
define n/ 'Nr_Cust' f=comma28.;
define pctn / 'PCT Cust' f=percent9.2;
define pctsum/ 'PCT X' f=percent9.2;
rbreak after /summarize  style (summary)=Header;
compute after;
region='Total';
endcomp;
run;
6 REPLIES 6
Kurt_Bremser
Super User

Put the label where you want it:

proc report data=raw  nowd;
column g x,(n sum  pctn pctsum);
define g /group    style(column)=header;
define x/" " analysis sum;
define n/ 'Nr_Cust' f=comma28.;
define sum / "X in MPLN" f=comma28.;
define pctn / 'PCT Cust' f=percent9.2;
define pctsum/ 'PCT X' f=percent9.2;
rbreak after /summarize  style (summary)=Header;
compute after;
region='Total';
endcomp;
run;
Ronein
Onyx | Level 15
Thank you.
I don't understand why for sum x need 2 statements?:
Define x
And another statement define sum
Ronein
Onyx | Level 15
I see that we have 4 statistics;
N sum pctn pctsum
For each statistics we create define statement.
And there is one more define statement for x with analysis sum.
My question bis why?
Why there are no also define statements for x with pctn
and for x with pctnsum?
Ronein
Onyx | Level 15
I see 6 items in define:
n sum pctn pctsum g x
I see 6 define statements.
But can you explain why dor define x we need to put sum?
Kurt_Bremser
Super User

When you omit a DEFINE statement for a column, SAS will use default parameters, in this case the name of the statistic as a label.

And if you define a label for the spanning column, you force SAS to put in an extra line for that. The empty label prevents that.

hackathon24-white-horiz.png

The 2025 SAS Hackathon has begun!

It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.

Latest Updates

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.

SAS Training: Just a Click Away

 Ready to level-up your skills? Choose your own adventure.

Browse our catalog!

Discussion stats
  • 6 replies
  • 1333 views
  • 0 likes
  • 2 in conversation