BookmarkSubscribeRSS Feed
Q1983
Lapis Lazuli | Level 10

data cars(keep= make type msrp cnt);

set sashelp.cars;

if make in ('Acura','BMW');

cnt=1;

run;

Proc tabulate =cars order= format=10. S=[cellwidth=80];

Class make type;

Var msrp cnt;

Table make='' all={label='Grand Total' S=[background = lightblue cellwidth=80]} *[STYLE=[Font_Weight=BOLD]],/*row*/

type*(cnt=''*sum='Count of Units' /*column*/

/*msrp=''*sum='MSRP$' *f=dollar16.2 /*msrp='' *colpctSum='% of MSRP'*f=number8.2*/ ) /*column*/

all={ label='Total' S=[background = lightblue]} *[STYLE=[Font_Weight=BOLD]] /*row total*/

*(cnt =' '*sum='Total Exceptions Units' msrp =' '*sum='Total MSRP Dollars$' *f=dollar16.2 /*row total detail*/

cnt=''*colpctn='Total % in Units' *f=number8.2 msrp=''*colpctSum='Total % in Dollars' *f=number8.2) /*row total detail*/

/ box='Car Summary';

keylabel n='';

run;

 

Is it possible to enter a statistic that captures the mean avg under the bottomline grand total?  So for example for SUV the mean avg would be 1.5

1 REPLY 1
ballardw
Super User

Please post code in a code box.

Please post code that actually runs if it should (your Proc tabulate statement has multiple missing elements especially DATA=)

If the question relates to calculations please do not include lots of style overrides and such. It makes it harder to reduce the to the basic question.

 

With Tabulate you are basically requesting statistics for either a row group or column. If you have statistics in the column, as SUM in this case , you cannot cross the SUM statistic with a MEAN for a single row.

 

You might want to use Proc Report as you could use a "compute after".

hackathon24-white-horiz.png

2025 SAS Hackathon: There is still time!

Good news: We've extended SAS Hackathon registration until Sept. 12, so you still have time to be part of our biggest event yet – our five-year anniversary!

Register Now

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
  • 1 reply
  • 607 views
  • 0 likes
  • 2 in conversation