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;
Catch the best of SAS Innovate 2025 — anytime, anywhere. Stream powerful keynotes, real-world demos, and game-changing insights from the world’s leading data and AI minds.
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.