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;
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;
Just count. How many items are in the COLUMN statement, and how many DEFINE statements do you have?
See?
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.
It's finally time to hack! Remember to visit the SAS Hacker's Hub regularly for news and updates.
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.
Ready to level-up your skills? Choose your own adventure.