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
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
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.