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
April 27 – 30 | Gaylord Texan | Grapevine, Texas
Walk in ready to learn. Walk out ready to deliver. This is the data and AI conference you can't afford to miss.
Register now and lock in 2025 pricing—just $495!
Still thinking about your presentation idea? The submission deadline has been extended to Friday, Nov. 14, at 11:59 p.m. ET.
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.