data one;
infile datalines;
input Group :$10. Count;
datalines;
R&D 2
Testing 3
Sales 8
;
run;
I have a data set like above and I need the output like this
| Group | Count |
| Group Total | 13 |
proc sql;
create table want as
select
'Group Total' as group,
sum(count) as count
from one;
quit;
Hello,
data one;
infile datalines;
input Group :$10. Count;
datalines;
R&D 2
Testing 3
Sales 8
;
run;
proc sql ;
select 'Group Total' as Group,sum(count) as count from one;
quit;
or
proc sql ;
create table want as
select 'Group Total' as Group,sum(count) as count from one;
quit;
Thanks 🙂
alternatively in a data step with end option and sum function
data want(drop=count rename=(count2=count));
set one end=eof;
count2+count;
if eof;
run;
@Jagadishkatam wrote:
alternatively in a data step with end option and sum function
data want; set one end=eof; count_+count; if eof; run;
Neat. Needs just a little code to create the wanted summary line text.
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 save with the early bird rate—just $795!
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.