In proc report, create a summary line:
Data ds1; Input empid $ salary1 Salary2; Cards; 101 45000 65000 102 56000 54333 103 43000 67777 104 43000 65000 105 45000 56000 106 56000 56788 ; proc report data=ds1; column empid salary1 salary2; define empid /display; define salary1/analysis; define salary2/analysis; rbreak after / summarize; compute after; empid = 'Total'; endcomp; run;
Result:
empid salary1 Salary2 101 45000 65000 102 56000 54333 103 43000 67777 104 43000 65000 105 45000 56000 106 56000 56788 Total 288000 364898
try the below code
Data ds1;
Input empid salary1 Salary2;
Cards;
101 45000 65000
102 56000 54333
103 43000 67777
104 43000 65000
105 45000 56000
106 56000 56788
;
Run;
proc sql;
create table want as select * from ds1
union all
select . as id , sum(salary1) as salary1, sum(salary2) as salary2 from ds1;
quit;
For a quick output PROC PRINT is sufficient:
proc print data=ds1;
sum s:;
run;
Are you ready for the spotlight? We're accepting content ideas for SAS Innovate 2025 to be held May 6-9 in Orlando, FL. The call is open until September 16. Read more here about why you should contribute and what is in it for you!
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.