BookmarkSubscribeRSS Feed
ysreenumba
Calcite | Level 5

Hi All,

 

how to rename deptno as "Total Sal of 10"  in result tab while using proc print.

 

data ndk;
input id name$ sal job $ deptno;
cards;
1 A 100 sales 10
3 C 300 hr 20
2 B 100 finance 30
4 D 400 sales 10
3 C 300 hr 20
;
run;
proc sort data=ndk out=nk;
by deptno;
run;
proc print data=nk;
by deptno;
sum sal;
run;

 

output

 

rename deptno.jpg

1 REPLY 1
Reeza
Super User

Use the SUMLABEL option with BY as illustrated here:

 

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; 

Source: http://support.sas.com/kb/51/927.html

 

 


@ysreenumba wrote:

Hi All,

 

how to rename deptno as "Total Sal of 10"  in result tab while using proc print.

 

data ndk;
input id name$ sal job $ deptno;
cards;
1 A 100 sales 10
3 C 300 hr 20
2 B 100 finance 30
4 D 400 sales 10
3 C 300 hr 20
;
run;
proc sort data=ndk out=nk;
by deptno;
run;
proc print data=nk;
by deptno;
sum sal;
run;

 

output

 

rename deptno.jpg


 

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
  • 1146 views
  • 0 likes
  • 2 in conversation