data sales;
input salesperson $ January February March ;
datalines;
Smith           1000        650        800
Johnson            0        900        900
Reed            1200        700        850
Davis           1050        900       1000
Thompson         750        850       1000
Peterson         900        600        500
Jones            800        900       1200
Murphy           700        800        700
Garcia           400       1200       1150
;
run;
proc print data=sales noobs sumlabel='Total' grandtotal_label='Grand Total' ;
sum January February March  ;
run;
I want to grand_total using grand_totallabel option but its not give
The label is displayed in the obs number column, so you need to omit the NOOBS option:
proc print
  data=sales
  sumlabel='Total'
  grandtotal_label='Grand Total'
;
sum January February March;
run;If you want it in the salesperson column, use PROC REPORT:
proc report data=sales;
column salesperson january february march;
define salesperson / display;
define january / sum;
define february / sum;
define march / sum;
rbreak after / summarize;
compute after;
  salesperson = "Grand Total";
endcomp;
run;proc sort data=sashelp.class out=class;                                    
   by sex;                                                                 
run;  
                                                             
proc format;                                                               
   value $genderf                                                          
      'F'='Female'                                                         
      'M'='Male';                                                          
run;                                              
                                                                           
proc print data=class noobs                                                
     sumlabel='#byval(sex) Total' grandtotal_label='Grand Total';   
   by sex;                                                                 
   var name age height weight;                                             
   sum height weight;                                                                                                                                 
   format sex $genderf.;                                                   
run;When you use BY, PROC PRINT knows where to put that label. Without BY, it can only use the obs column.
I generally use a different report procedure, either Tabulate or Report to have more control over things and avoid the sometimes esoteric interactions of the Proc Print options.
proc tabulate data=sales;
   class salesperson;
   var January February March;
   table salesperson='' All='Grand Total'  ,
         (January February March)*sum=''*f=best8.
         /box = 'Sales Person'
   ;
run;
Also it seems like as soon as I do the basic report I get asked something like "What is the mean for each Sales person?" which Proc Print won't do.
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.
